Skip to content

Commit

Permalink
Get kernel_size directly from attribute to avoid incorrect assumption…
Browse files Browse the repository at this point in the history
…s of var names
  • Loading branch information
TylerYep committed May 15, 2022
1 parent fbc3468 commit 793c4f5
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 65 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ disable =
too-many-branches,
too-many-locals,
invalid-name,
line-too-long,
line-too-long, # Covered by flake8
no-member,
fixme,
duplicate-code,
Expand Down
30 changes: 15 additions & 15 deletions tests/test_output/autoencoder.out
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
==========================================================================================
Layer (type:depth-idx) Output Shape Param #
==========================================================================================
AutoEncoder -- --
├─Sequential: 1-1 [1, 16, 64, 64] --
│ └─Conv2d: 2-1 [1, 16, 64, 64] 448
│ └─ReLU: 2-2 [1, 16, 64, 64] --
├─MaxPool2d: 1-2 [1, 16, 32, 32] --
├─MaxUnpool2d: 1-3 [1, 16, 64, 64] --
├─Sequential: 1-4 [1, 3, 64, 64] --
│ └─Conv2d: 2-3 [1, 3, 64, 64] 435
│ └─ReLU: 2-4 [1, 3, 64, 64] --
==========================================================================================
===================================================================================================================
Layer (type:depth-idx) Output Shape Param # Kernel Shape
===================================================================================================================
AutoEncoder -- -- --
├─Sequential: 1-1 [1, 16, 64, 64] -- --
│ └─Conv2d: 2-1 [1, 16, 64, 64] 448 [3, 3]
│ └─ReLU: 2-2 [1, 16, 64, 64] -- --
├─MaxPool2d: 1-2 [1, 16, 32, 32] -- 2
├─MaxUnpool2d: 1-3 [1, 16, 64, 64] -- [2, 2]
├─Sequential: 1-4 [1, 3, 64, 64] -- --
│ └─Conv2d: 2-3 [1, 3, 64, 64] 435 [3, 3]
│ └─ReLU: 2-4 [1, 3, 64, 64] -- --
===================================================================================================================
Total params: 883
Trainable params: 883
Non-trainable params: 0
Total mult-adds (M): 3.62
==========================================================================================
===================================================================================================================
Input size (MB): 0.05
Forward/backward pass size (MB): 0.62
Params size (MB): 0.00
Estimated Total Size (MB): 0.68
==========================================================================================
===================================================================================================================
72 changes: 36 additions & 36 deletions tests/test_output/frozen_layers.out
Original file line number Diff line number Diff line change
Expand Up @@ -2,75 +2,75 @@
Layer (type:depth-idx) Output Shape Param # Kernel Shape Mult-Adds
============================================================================================================================================
ResNet -- -- -- --
├─Conv2d: 1-1 [1, 64, 32, 32] (9,408) [3, 64, 7, 7] 9,633,792
├─BatchNorm2d: 1-2 [1, 64, 32, 32] (128) [64] 128
├─Conv2d: 1-1 [1, 64, 32, 32] (9,408) [7, 7] 9,633,792
├─BatchNorm2d: 1-2 [1, 64, 32, 32] (128) -- 128
├─ReLU: 1-3 [1, 64, 32, 32] -- -- --
├─MaxPool2d: 1-4 [1, 64, 16, 16] -- -- --
├─MaxPool2d: 1-4 [1, 64, 16, 16] -- 3 --
├─Sequential: 1-5 [1, 64, 16, 16] -- -- --
│ └─BasicBlock: 2-1 [1, 64, 16, 16] -- -- --
│ │ └─Conv2d: 3-1 [1, 64, 16, 16] (36,864) [64, 64, 3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-2 [1, 64, 16, 16] (128) [64] 128
│ │ └─Conv2d: 3-1 [1, 64, 16, 16] (36,864) [3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-2 [1, 64, 16, 16] (128) -- 128
│ │ └─ReLU: 3-3 [1, 64, 16, 16] -- -- --
│ │ └─Conv2d: 3-4 [1, 64, 16, 16] (36,864) [64, 64, 3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-5 [1, 64, 16, 16] (128) [64] 128
│ │ └─Conv2d: 3-4 [1, 64, 16, 16] (36,864) [3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-5 [1, 64, 16, 16] (128) -- 128
│ │ └─ReLU: 3-6 [1, 64, 16, 16] -- -- --
│ └─BasicBlock: 2-2 [1, 64, 16, 16] -- -- --
│ │ └─Conv2d: 3-7 [1, 64, 16, 16] (36,864) [64, 64, 3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-8 [1, 64, 16, 16] (128) [64] 128
│ │ └─Conv2d: 3-7 [1, 64, 16, 16] (36,864) [3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-8 [1, 64, 16, 16] (128) -- 128
│ │ └─ReLU: 3-9 [1, 64, 16, 16] -- -- --
│ │ └─Conv2d: 3-10 [1, 64, 16, 16] (36,864) [64, 64, 3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-11 [1, 64, 16, 16] (128) [64] 128
│ │ └─Conv2d: 3-10 [1, 64, 16, 16] (36,864) [3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-11 [1, 64, 16, 16] (128) -- 128
│ │ └─ReLU: 3-12 [1, 64, 16, 16] -- -- --
├─Sequential: 1-6 [1, 128, 8, 8] -- -- --
│ └─BasicBlock: 2-3 [1, 128, 8, 8] -- -- --
│ │ └─Conv2d: 3-13 [1, 128, 8, 8] (73,728) [64, 128, 3, 3] 4,718,592
│ │ └─BatchNorm2d: 3-14 [1, 128, 8, 8] (256) [128] 256
│ │ └─Conv2d: 3-13 [1, 128, 8, 8] (73,728) [3, 3] 4,718,592
│ │ └─BatchNorm2d: 3-14 [1, 128, 8, 8] (256) -- 256
│ │ └─ReLU: 3-15 [1, 128, 8, 8] -- -- --
│ │ └─Conv2d: 3-16 [1, 128, 8, 8] (147,456) [128, 128, 3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-17 [1, 128, 8, 8] (256) [128] 256
│ │ └─Conv2d: 3-16 [1, 128, 8, 8] (147,456) [3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-17 [1, 128, 8, 8] (256) -- 256
│ │ └─Sequential: 3-18 [1, 128, 8, 8] (8,448) -- 524,544
│ │ └─ReLU: 3-19 [1, 128, 8, 8] -- -- --
│ └─BasicBlock: 2-4 [1, 128, 8, 8] -- -- --
│ │ └─Conv2d: 3-20 [1, 128, 8, 8] (147,456) [128, 128, 3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-21 [1, 128, 8, 8] (256) [128] 256
│ │ └─Conv2d: 3-20 [1, 128, 8, 8] (147,456) [3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-21 [1, 128, 8, 8] (256) -- 256
│ │ └─ReLU: 3-22 [1, 128, 8, 8] -- -- --
│ │ └─Conv2d: 3-23 [1, 128, 8, 8] (147,456) [128, 128, 3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-24 [1, 128, 8, 8] (256) [128] 256
│ │ └─Conv2d: 3-23 [1, 128, 8, 8] (147,456) [3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-24 [1, 128, 8, 8] (256) -- 256
│ │ └─ReLU: 3-25 [1, 128, 8, 8] -- -- --
├─Sequential: 1-7 [1, 256, 4, 4] -- -- --
│ └─BasicBlock: 2-5 [1, 256, 4, 4] -- -- --
│ │ └─Conv2d: 3-26 [1, 256, 4, 4] 294,912 [128, 256, 3, 3] 4,718,592
│ │ └─BatchNorm2d: 3-27 [1, 256, 4, 4] 512 [256] 512
│ │ └─Conv2d: 3-26 [1, 256, 4, 4] 294,912 [3, 3] 4,718,592
│ │ └─BatchNorm2d: 3-27 [1, 256, 4, 4] 512 -- 512
│ │ └─ReLU: 3-28 [1, 256, 4, 4] -- -- --
│ │ └─Conv2d: 3-29 [1, 256, 4, 4] 589,824 [256, 256, 3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-30 [1, 256, 4, 4] 512 [256] 512
│ │ └─Conv2d: 3-29 [1, 256, 4, 4] 589,824 [3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-30 [1, 256, 4, 4] 512 -- 512
│ │ └─Sequential: 3-31 [1, 256, 4, 4] 33,280 -- 524,800
│ │ └─ReLU: 3-32 [1, 256, 4, 4] -- -- --
│ └─BasicBlock: 2-6 [1, 256, 4, 4] -- -- --
│ │ └─Conv2d: 3-33 [1, 256, 4, 4] 589,824 [256, 256, 3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-34 [1, 256, 4, 4] 512 [256] 512
│ │ └─Conv2d: 3-33 [1, 256, 4, 4] 589,824 [3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-34 [1, 256, 4, 4] 512 -- 512
│ │ └─ReLU: 3-35 [1, 256, 4, 4] -- -- --
│ │ └─Conv2d: 3-36 [1, 256, 4, 4] 589,824 [256, 256, 3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-37 [1, 256, 4, 4] 512 [256] 512
│ │ └─Conv2d: 3-36 [1, 256, 4, 4] 589,824 [3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-37 [1, 256, 4, 4] 512 -- 512
│ │ └─ReLU: 3-38 [1, 256, 4, 4] -- -- --
├─Sequential: 1-8 [1, 512, 2, 2] -- -- --
│ └─BasicBlock: 2-7 [1, 512, 2, 2] -- -- --
│ │ └─Conv2d: 3-39 [1, 512, 2, 2] 1,179,648 [256, 512, 3, 3] 4,718,592
│ │ └─BatchNorm2d: 3-40 [1, 512, 2, 2] 1,024 [512] 1,024
│ │ └─Conv2d: 3-39 [1, 512, 2, 2] 1,179,648 [3, 3] 4,718,592
│ │ └─BatchNorm2d: 3-40 [1, 512, 2, 2] 1,024 -- 1,024
│ │ └─ReLU: 3-41 [1, 512, 2, 2] -- -- --
│ │ └─Conv2d: 3-42 [1, 512, 2, 2] 2,359,296 [512, 512, 3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-43 [1, 512, 2, 2] 1,024 [512] 1,024
│ │ └─Conv2d: 3-42 [1, 512, 2, 2] 2,359,296 [3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-43 [1, 512, 2, 2] 1,024 -- 1,024
│ │ └─Sequential: 3-44 [1, 512, 2, 2] 132,096 -- 525,312
│ │ └─ReLU: 3-45 [1, 512, 2, 2] -- -- --
│ └─BasicBlock: 2-8 [1, 512, 2, 2] -- -- --
│ │ └─Conv2d: 3-46 [1, 512, 2, 2] 2,359,296 [512, 512, 3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-47 [1, 512, 2, 2] 1,024 [512] 1,024
│ │ └─Conv2d: 3-46 [1, 512, 2, 2] 2,359,296 [3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-47 [1, 512, 2, 2] 1,024 -- 1,024
│ │ └─ReLU: 3-48 [1, 512, 2, 2] -- -- --
│ │ └─Conv2d: 3-49 [1, 512, 2, 2] 2,359,296 [512, 512, 3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-50 [1, 512, 2, 2] 1,024 [512] 1,024
│ │ └─Conv2d: 3-49 [1, 512, 2, 2] 2,359,296 [3, 3] 9,437,184
│ │ └─BatchNorm2d: 3-50 [1, 512, 2, 2] 1,024 -- 1,024
│ │ └─ReLU: 3-51 [1, 512, 2, 2] -- -- --
├─AdaptiveAvgPool2d: 1-9 [1, 512, 1, 1] -- -- --
├─Linear: 1-10 [1, 1000] 513,000 [512, 1000] 513,000
├─Linear: 1-10 [1, 1000] 513,000 -- 513,000
============================================================================================================================================
Total params: 11,689,512
Trainable params: 11,006,440
Expand Down
4 changes: 2 additions & 2 deletions tests/test_output/lstm.out
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Layer (type (var_name)) Kernel Shape Output Shape Param # Mult-Adds
========================================================================================================================
LSTMNet -- -- -- --
├─Embedding (embedding) [300, 20] [1, 100, 300] 6,000 6,000
├─Embedding (embedding) -- [1, 100, 300] 6,000 6,000
│ └─weight [300, 20] └─6,000
├─LSTM (encoder) -- [1, 100, 512] 3,768,320 376,832,000
│ └─weight_ih_l0 [2048, 300] ├─614,400
Expand All @@ -13,7 +13,7 @@ LSTMNet -- --
│ └─weight_hh_l1 [2048, 512] ├─1,048,576
│ └─bias_ih_l1 [2048] ├─2,048
│ └─bias_hh_l1 [2048] └─2,048
├─Linear (decoder) [512, 20] [1, 100, 20] 10,260 10,260
├─Linear (decoder) -- [1, 100, 20] 10,260 10,260
│ └─weight [512, 20] ├─10,240
│ └─bias [20] └─20
========================================================================================================================
Expand Down
Loading

0 comments on commit 793c4f5

Please sign in to comment.