[d869a2]: / Notebooks / 14_torchinfo_for_baseline.ipynb

Download this file

146 lines (145 with data), 12.1 kB

{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from torchinfo import summary\n",
    "\n",
    "from wearsed.models.baseline_conv.BaselineConv import BaselineConv"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "model = BaselineConv(in_channels=6)\n",
    "batch_size = 64"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "summary(model, input_size=(batch_size, 6, 600))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'\\n==========================================================================================\\nLayer (type:depth-idx)                   Output Shape              Param #\\n==========================================================================================\\nBaselineConv                             [64, 600]                 --\\n├─Sequential: 1-1                        [64, 64, 600]             --\\n│    └─Conv1d: 2-1                       [64, 64, 600]             1,216\\n│    └─ReLU: 2-2                         [64, 64, 600]             --\\n│    └─Conv1d: 2-3                       [64, 64, 600]             12,352\\n│    └─ReLU: 2-4                         [64, 64, 600]             --\\n├─MaxPool1d: 1-2                         [64, 64, 300]             --\\n├─Sequential: 1-3                        [64, 128, 300]            --\\n│    └─Conv1d: 2-5                       [64, 128, 300]            24,704\\n│    └─ReLU: 2-6                         [64, 128, 300]            --\\n│    └─Conv1d: 2-7                       [64, 128, 300]            49,280\\n│    └─ReLU: 2-8                         [64, 128, 300]            --\\n├─MaxPool1d: 1-4                         [64, 128, 150]            --\\n├─Sequential: 1-5                        [64, 256, 150]            --\\n│    └─Conv1d: 2-9                       [64, 256, 150]            98,560\\n│    └─ReLU: 2-10                        [64, 256, 150]            --\\n│    └─Conv1d: 2-11                      [64, 256, 150]            196,864\\n│    └─ReLU: 2-12                        [64, 256, 150]            --\\n├─MaxPool1d: 1-6                         [64, 256, 75]             --\\n├─Sequential: 1-7                        [64, 512, 75]             --\\n│    └─Conv1d: 2-13                      [64, 512, 75]             393,728\\n│    └─ReLU: 2-14                        [64, 512, 75]             --\\n│    └─Conv1d: 2-15                      [64, 512, 75]             786,944\\n│    └─ReLU: 2-16                        [64, 512, 75]             --\\n├─MaxPool1d: 1-8                         [64, 512, 37]             --\\n├─Sequential: 1-9                        [64, 1024, 37]            --\\n│    └─Conv1d: 2-17                      [64, 1024, 37]            1,573,888\\n│    └─ReLU: 2-18                        [64, 1024, 37]            --\\n│    └─Conv1d: 2-19                      [64, 1024, 37]            3,146,752\\n│    └─ReLU: 2-20                        [64, 1024, 37]            --\\n├─ConvTranspose1d: 1-10                  [64, 512, 75]             1,049,088\\n├─Sequential: 1-11                       [64, 512, 75]             --\\n│    └─Conv1d: 2-21                      [64, 512, 75]             1,573,376\\n│    └─ReLU: 2-22                        [64, 512, 75]             --\\n│    └─Conv1d: 2-23                      [64, 512, 75]             786,944\\n│    └─ReLU: 2-24                        [64, 512, 75]             --\\n├─ConvTranspose1d: 1-12                  [64, 256, 150]            262,400\\n├─Sequential: 1-13                       [64, 256, 150]            --\\n│    └─Conv1d: 2-25                      [64, 256, 150]            393,472\\n│    └─ReLU: 2-26                        [64, 256, 150]            --\\n│    └─Conv1d: 2-27                      [64, 256, 150]            196,864\\n│    └─ReLU: 2-28                        [64, 256, 150]            --\\n├─ConvTranspose1d: 1-14                  [64, 128, 300]            65,664\\n├─Sequential: 1-15                       [64, 128, 300]            --\\n│    └─Conv1d: 2-29                      [64, 128, 300]            98,432\\n│    └─ReLU: 2-30                        [64, 128, 300]            --\\n│    └─Conv1d: 2-31                      [64, 128, 300]            49,280\\n│    └─ReLU: 2-32                        [64, 128, 300]            --\\n├─ConvTranspose1d: 1-16                  [64, 64, 600]             16,448\\n├─Sequential: 1-17                       [64, 64, 600]             --\\n│    └─Conv1d: 2-33                      [64, 64, 600]             24,640\\n│    └─ReLU: 2-34                        [64, 64, 600]             --\\n│    └─Conv1d: 2-35                      [64, 64, 600]             12,352\\n│    └─ReLU: 2-36                        [64, 64, 600]             --\\n├─Conv1d: 1-18                           [64, 1, 600]              65\\n==========================================================================================\\nTotal params: 10,813,313\\nTrainable params: 10,813,313\\nNon-trainable params: 0\\nTotal mult-adds (Units.GIGABYTES): 52.33\\n==========================================================================================\\nInput size (MB): 0.92\\nForward/backward pass size (MB): 432.32\\nParams size (MB): 43.25\\nEstimated Total Size (MB): 476.50\\n==========================================================================================\\n'"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "'''\n",
    "==========================================================================================\n",
    "Layer (type:depth-idx)                   Output Shape              Param #\n",
    "==========================================================================================\n",
    "BaselineConv                             [64, 600]                 --\n",
    "├─Sequential: 1-1                        [64, 64, 600]             --\n",
    "│    └─Conv1d: 2-1                       [64, 64, 600]             1,216\n",
    "│    └─ReLU: 2-2                         [64, 64, 600]             --\n",
    "│    └─Conv1d: 2-3                       [64, 64, 600]             12,352\n",
    "│    └─ReLU: 2-4                         [64, 64, 600]             --\n",
    "├─MaxPool1d: 1-2                         [64, 64, 300]             --\n",
    "├─Sequential: 1-3                        [64, 128, 300]            --\n",
    "│    └─Conv1d: 2-5                       [64, 128, 300]            24,704\n",
    "│    └─ReLU: 2-6                         [64, 128, 300]            --\n",
    "│    └─Conv1d: 2-7                       [64, 128, 300]            49,280\n",
    "│    └─ReLU: 2-8                         [64, 128, 300]            --\n",
    "├─MaxPool1d: 1-4                         [64, 128, 150]            --\n",
    "├─Sequential: 1-5                        [64, 256, 150]            --\n",
    "│    └─Conv1d: 2-9                       [64, 256, 150]            98,560\n",
    "│    └─ReLU: 2-10                        [64, 256, 150]            --\n",
    "│    └─Conv1d: 2-11                      [64, 256, 150]            196,864\n",
    "│    └─ReLU: 2-12                        [64, 256, 150]            --\n",
    "├─MaxPool1d: 1-6                         [64, 256, 75]             --\n",
    "├─Sequential: 1-7                        [64, 512, 75]             --\n",
    "│    └─Conv1d: 2-13                      [64, 512, 75]             393,728\n",
    "│    └─ReLU: 2-14                        [64, 512, 75]             --\n",
    "│    └─Conv1d: 2-15                      [64, 512, 75]             786,944\n",
    "│    └─ReLU: 2-16                        [64, 512, 75]             --\n",
    "├─MaxPool1d: 1-8                         [64, 512, 37]             --\n",
    "├─Sequential: 1-9                        [64, 1024, 37]            --\n",
    "│    └─Conv1d: 2-17                      [64, 1024, 37]            1,573,888\n",
    "│    └─ReLU: 2-18                        [64, 1024, 37]            --\n",
    "│    └─Conv1d: 2-19                      [64, 1024, 37]            3,146,752\n",
    "│    └─ReLU: 2-20                        [64, 1024, 37]            --\n",
    "├─ConvTranspose1d: 1-10                  [64, 512, 75]             1,049,088\n",
    "├─Sequential: 1-11                       [64, 512, 75]             --\n",
    "│    └─Conv1d: 2-21                      [64, 512, 75]             1,573,376\n",
    "│    └─ReLU: 2-22                        [64, 512, 75]             --\n",
    "│    └─Conv1d: 2-23                      [64, 512, 75]             786,944\n",
    "│    └─ReLU: 2-24                        [64, 512, 75]             --\n",
    "├─ConvTranspose1d: 1-12                  [64, 256, 150]            262,400\n",
    "├─Sequential: 1-13                       [64, 256, 150]            --\n",
    "│    └─Conv1d: 2-25                      [64, 256, 150]            393,472\n",
    "│    └─ReLU: 2-26                        [64, 256, 150]            --\n",
    "│    └─Conv1d: 2-27                      [64, 256, 150]            196,864\n",
    "│    └─ReLU: 2-28                        [64, 256, 150]            --\n",
    "├─ConvTranspose1d: 1-14                  [64, 128, 300]            65,664\n",
    "├─Sequential: 1-15                       [64, 128, 300]            --\n",
    "│    └─Conv1d: 2-29                      [64, 128, 300]            98,432\n",
    "│    └─ReLU: 2-30                        [64, 128, 300]            --\n",
    "│    └─Conv1d: 2-31                      [64, 128, 300]            49,280\n",
    "│    └─ReLU: 2-32                        [64, 128, 300]            --\n",
    "├─ConvTranspose1d: 1-16                  [64, 64, 600]             16,448\n",
    "├─Sequential: 1-17                       [64, 64, 600]             --\n",
    "│    └─Conv1d: 2-33                      [64, 64, 600]             24,640\n",
    "│    └─ReLU: 2-34                        [64, 64, 600]             --\n",
    "│    └─Conv1d: 2-35                      [64, 64, 600]             12,352\n",
    "│    └─ReLU: 2-36                        [64, 64, 600]             --\n",
    "├─Conv1d: 1-18                           [64, 1, 600]              65\n",
    "==========================================================================================\n",
    "Total params: 10,813,313\n",
    "Trainable params: 10,813,313\n",
    "Non-trainable params: 0\n",
    "Total mult-adds (Units.GIGABYTES): 52.33\n",
    "==========================================================================================\n",
    "Input size (MB): 0.92\n",
    "Forward/backward pass size (MB): 432.32\n",
    "Params size (MB): 43.25\n",
    "Estimated Total Size (MB): 476.50\n",
    "==========================================================================================\n",
    "'''"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "master",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}