Skip to content

Commit 793c4f5

Browse files
committed
Get kernel_size directly from attribute to avoid incorrect assumptions of var names
1 parent fbc3468 commit 793c4f5

8 files changed

Lines changed: 87 additions & 65 deletions

File tree

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ disable =
5252
too-many-branches,
5353
too-many-locals,
5454
invalid-name,
55-
line-too-long,
55+
line-too-long, # Covered by flake8
5656
no-member,
5757
fixme,
5858
duplicate-code,

tests/test_output/autoencoder.out

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
==========================================================================================
2-
Layer (type:depth-idx) Output Shape Param #
3-
==========================================================================================
4-
AutoEncoder -- --
5-
├─Sequential: 1-1 [1, 16, 64, 64] --
6-
│ └─Conv2d: 2-1 [1, 16, 64, 64] 448
7-
│ └─ReLU: 2-2 [1, 16, 64, 64] --
8-
├─MaxPool2d: 1-2 [1, 16, 32, 32] --
9-
├─MaxUnpool2d: 1-3 [1, 16, 64, 64] --
10-
├─Sequential: 1-4 [1, 3, 64, 64] --
11-
│ └─Conv2d: 2-3 [1, 3, 64, 64] 435
12-
│ └─ReLU: 2-4 [1, 3, 64, 64] --
13-
==========================================================================================
1+
===================================================================================================================
2+
Layer (type:depth-idx) Output Shape Param # Kernel Shape
3+
===================================================================================================================
4+
AutoEncoder -- -- --
5+
├─Sequential: 1-1 [1, 16, 64, 64] -- --
6+
│ └─Conv2d: 2-1 [1, 16, 64, 64] 448 [3, 3]
7+
│ └─ReLU: 2-2 [1, 16, 64, 64] -- --
8+
├─MaxPool2d: 1-2 [1, 16, 32, 32] -- 2
9+
├─MaxUnpool2d: 1-3 [1, 16, 64, 64] -- [2, 2]
10+
├─Sequential: 1-4 [1, 3, 64, 64] -- --
11+
│ └─Conv2d: 2-3 [1, 3, 64, 64] 435 [3, 3]
12+
│ └─ReLU: 2-4 [1, 3, 64, 64] -- --
13+
===================================================================================================================
1414
Total params: 883
1515
Trainable params: 883
1616
Non-trainable params: 0
1717
Total mult-adds (M): 3.62
18-
==========================================================================================
18+
===================================================================================================================
1919
Input size (MB): 0.05
2020
Forward/backward pass size (MB): 0.62
2121
Params size (MB): 0.00
2222
Estimated Total Size (MB): 0.68
23-
==========================================================================================
23+
===================================================================================================================

tests/test_output/frozen_layers.out

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,75 +2,75 @@
22
Layer (type:depth-idx) Output Shape Param # Kernel Shape Mult-Adds
33
============================================================================================================================================
44
ResNet -- -- -- --
5-
├─Conv2d: 1-1 [1, 64, 32, 32] (9,408) [3, 64, 7, 7] 9,633,792
6-
├─BatchNorm2d: 1-2 [1, 64, 32, 32] (128) [64] 128
5+
├─Conv2d: 1-1 [1, 64, 32, 32] (9,408) [7, 7] 9,633,792
6+
├─BatchNorm2d: 1-2 [1, 64, 32, 32] (128) -- 128
77
├─ReLU: 1-3 [1, 64, 32, 32] -- -- --
8-
├─MaxPool2d: 1-4 [1, 64, 16, 16] -- -- --
8+
├─MaxPool2d: 1-4 [1, 64, 16, 16] -- 3 --
99
├─Sequential: 1-5 [1, 64, 16, 16] -- -- --
1010
│ └─BasicBlock: 2-1 [1, 64, 16, 16] -- -- --
11-
│ │ └─Conv2d: 3-1 [1, 64, 16, 16] (36,864) [64, 64, 3, 3] 9,437,184
12-
│ │ └─BatchNorm2d: 3-2 [1, 64, 16, 16] (128) [64] 128
11+
│ │ └─Conv2d: 3-1 [1, 64, 16, 16] (36,864) [3, 3] 9,437,184
12+
│ │ └─BatchNorm2d: 3-2 [1, 64, 16, 16] (128) -- 128
1313
│ │ └─ReLU: 3-3 [1, 64, 16, 16] -- -- --
14-
│ │ └─Conv2d: 3-4 [1, 64, 16, 16] (36,864) [64, 64, 3, 3] 9,437,184
15-
│ │ └─BatchNorm2d: 3-5 [1, 64, 16, 16] (128) [64] 128
14+
│ │ └─Conv2d: 3-4 [1, 64, 16, 16] (36,864) [3, 3] 9,437,184
15+
│ │ └─BatchNorm2d: 3-5 [1, 64, 16, 16] (128) -- 128
1616
│ │ └─ReLU: 3-6 [1, 64, 16, 16] -- -- --
1717
│ └─BasicBlock: 2-2 [1, 64, 16, 16] -- -- --
18-
│ │ └─Conv2d: 3-7 [1, 64, 16, 16] (36,864) [64, 64, 3, 3] 9,437,184
19-
│ │ └─BatchNorm2d: 3-8 [1, 64, 16, 16] (128) [64] 128
18+
│ │ └─Conv2d: 3-7 [1, 64, 16, 16] (36,864) [3, 3] 9,437,184
19+
│ │ └─BatchNorm2d: 3-8 [1, 64, 16, 16] (128) -- 128
2020
│ │ └─ReLU: 3-9 [1, 64, 16, 16] -- -- --
21-
│ │ └─Conv2d: 3-10 [1, 64, 16, 16] (36,864) [64, 64, 3, 3] 9,437,184
22-
│ │ └─BatchNorm2d: 3-11 [1, 64, 16, 16] (128) [64] 128
21+
│ │ └─Conv2d: 3-10 [1, 64, 16, 16] (36,864) [3, 3] 9,437,184
22+
│ │ └─BatchNorm2d: 3-11 [1, 64, 16, 16] (128) -- 128
2323
│ │ └─ReLU: 3-12 [1, 64, 16, 16] -- -- --
2424
├─Sequential: 1-6 [1, 128, 8, 8] -- -- --
2525
│ └─BasicBlock: 2-3 [1, 128, 8, 8] -- -- --
26-
│ │ └─Conv2d: 3-13 [1, 128, 8, 8] (73,728) [64, 128, 3, 3] 4,718,592
27-
│ │ └─BatchNorm2d: 3-14 [1, 128, 8, 8] (256) [128] 256
26+
│ │ └─Conv2d: 3-13 [1, 128, 8, 8] (73,728) [3, 3] 4,718,592
27+
│ │ └─BatchNorm2d: 3-14 [1, 128, 8, 8] (256) -- 256
2828
│ │ └─ReLU: 3-15 [1, 128, 8, 8] -- -- --
29-
│ │ └─Conv2d: 3-16 [1, 128, 8, 8] (147,456) [128, 128, 3, 3] 9,437,184
30-
│ │ └─BatchNorm2d: 3-17 [1, 128, 8, 8] (256) [128] 256
29+
│ │ └─Conv2d: 3-16 [1, 128, 8, 8] (147,456) [3, 3] 9,437,184
30+
│ │ └─BatchNorm2d: 3-17 [1, 128, 8, 8] (256) -- 256
3131
│ │ └─Sequential: 3-18 [1, 128, 8, 8] (8,448) -- 524,544
3232
│ │ └─ReLU: 3-19 [1, 128, 8, 8] -- -- --
3333
│ └─BasicBlock: 2-4 [1, 128, 8, 8] -- -- --
34-
│ │ └─Conv2d: 3-20 [1, 128, 8, 8] (147,456) [128, 128, 3, 3] 9,437,184
35-
│ │ └─BatchNorm2d: 3-21 [1, 128, 8, 8] (256) [128] 256
34+
│ │ └─Conv2d: 3-20 [1, 128, 8, 8] (147,456) [3, 3] 9,437,184
35+
│ │ └─BatchNorm2d: 3-21 [1, 128, 8, 8] (256) -- 256
3636
│ │ └─ReLU: 3-22 [1, 128, 8, 8] -- -- --
37-
│ │ └─Conv2d: 3-23 [1, 128, 8, 8] (147,456) [128, 128, 3, 3] 9,437,184
38-
│ │ └─BatchNorm2d: 3-24 [1, 128, 8, 8] (256) [128] 256
37+
│ │ └─Conv2d: 3-23 [1, 128, 8, 8] (147,456) [3, 3] 9,437,184
38+
│ │ └─BatchNorm2d: 3-24 [1, 128, 8, 8] (256) -- 256
3939
│ │ └─ReLU: 3-25 [1, 128, 8, 8] -- -- --
4040
├─Sequential: 1-7 [1, 256, 4, 4] -- -- --
4141
│ └─BasicBlock: 2-5 [1, 256, 4, 4] -- -- --
42-
│ │ └─Conv2d: 3-26 [1, 256, 4, 4] 294,912 [128, 256, 3, 3] 4,718,592
43-
│ │ └─BatchNorm2d: 3-27 [1, 256, 4, 4] 512 [256] 512
42+
│ │ └─Conv2d: 3-26 [1, 256, 4, 4] 294,912 [3, 3] 4,718,592
43+
│ │ └─BatchNorm2d: 3-27 [1, 256, 4, 4] 512 -- 512
4444
│ │ └─ReLU: 3-28 [1, 256, 4, 4] -- -- --
45-
│ │ └─Conv2d: 3-29 [1, 256, 4, 4] 589,824 [256, 256, 3, 3] 9,437,184
46-
│ │ └─BatchNorm2d: 3-30 [1, 256, 4, 4] 512 [256] 512
45+
│ │ └─Conv2d: 3-29 [1, 256, 4, 4] 589,824 [3, 3] 9,437,184
46+
│ │ └─BatchNorm2d: 3-30 [1, 256, 4, 4] 512 -- 512
4747
│ │ └─Sequential: 3-31 [1, 256, 4, 4] 33,280 -- 524,800
4848
│ │ └─ReLU: 3-32 [1, 256, 4, 4] -- -- --
4949
│ └─BasicBlock: 2-6 [1, 256, 4, 4] -- -- --
50-
│ │ └─Conv2d: 3-33 [1, 256, 4, 4] 589,824 [256, 256, 3, 3] 9,437,184
51-
│ │ └─BatchNorm2d: 3-34 [1, 256, 4, 4] 512 [256] 512
50+
│ │ └─Conv2d: 3-33 [1, 256, 4, 4] 589,824 [3, 3] 9,437,184
51+
│ │ └─BatchNorm2d: 3-34 [1, 256, 4, 4] 512 -- 512
5252
│ │ └─ReLU: 3-35 [1, 256, 4, 4] -- -- --
53-
│ │ └─Conv2d: 3-36 [1, 256, 4, 4] 589,824 [256, 256, 3, 3] 9,437,184
54-
│ │ └─BatchNorm2d: 3-37 [1, 256, 4, 4] 512 [256] 512
53+
│ │ └─Conv2d: 3-36 [1, 256, 4, 4] 589,824 [3, 3] 9,437,184
54+
│ │ └─BatchNorm2d: 3-37 [1, 256, 4, 4] 512 -- 512
5555
│ │ └─ReLU: 3-38 [1, 256, 4, 4] -- -- --
5656
├─Sequential: 1-8 [1, 512, 2, 2] -- -- --
5757
│ └─BasicBlock: 2-7 [1, 512, 2, 2] -- -- --
58-
│ │ └─Conv2d: 3-39 [1, 512, 2, 2] 1,179,648 [256, 512, 3, 3] 4,718,592
59-
│ │ └─BatchNorm2d: 3-40 [1, 512, 2, 2] 1,024 [512] 1,024
58+
│ │ └─Conv2d: 3-39 [1, 512, 2, 2] 1,179,648 [3, 3] 4,718,592
59+
│ │ └─BatchNorm2d: 3-40 [1, 512, 2, 2] 1,024 -- 1,024
6060
│ │ └─ReLU: 3-41 [1, 512, 2, 2] -- -- --
61-
│ │ └─Conv2d: 3-42 [1, 512, 2, 2] 2,359,296 [512, 512, 3, 3] 9,437,184
62-
│ │ └─BatchNorm2d: 3-43 [1, 512, 2, 2] 1,024 [512] 1,024
61+
│ │ └─Conv2d: 3-42 [1, 512, 2, 2] 2,359,296 [3, 3] 9,437,184
62+
│ │ └─BatchNorm2d: 3-43 [1, 512, 2, 2] 1,024 -- 1,024
6363
│ │ └─Sequential: 3-44 [1, 512, 2, 2] 132,096 -- 525,312
6464
│ │ └─ReLU: 3-45 [1, 512, 2, 2] -- -- --
6565
│ └─BasicBlock: 2-8 [1, 512, 2, 2] -- -- --
66-
│ │ └─Conv2d: 3-46 [1, 512, 2, 2] 2,359,296 [512, 512, 3, 3] 9,437,184
67-
│ │ └─BatchNorm2d: 3-47 [1, 512, 2, 2] 1,024 [512] 1,024
66+
│ │ └─Conv2d: 3-46 [1, 512, 2, 2] 2,359,296 [3, 3] 9,437,184
67+
│ │ └─BatchNorm2d: 3-47 [1, 512, 2, 2] 1,024 -- 1,024
6868
│ │ └─ReLU: 3-48 [1, 512, 2, 2] -- -- --
69-
│ │ └─Conv2d: 3-49 [1, 512, 2, 2] 2,359,296 [512, 512, 3, 3] 9,437,184
70-
│ │ └─BatchNorm2d: 3-50 [1, 512, 2, 2] 1,024 [512] 1,024
69+
│ │ └─Conv2d: 3-49 [1, 512, 2, 2] 2,359,296 [3, 3] 9,437,184
70+
│ │ └─BatchNorm2d: 3-50 [1, 512, 2, 2] 1,024 -- 1,024
7171
│ │ └─ReLU: 3-51 [1, 512, 2, 2] -- -- --
7272
├─AdaptiveAvgPool2d: 1-9 [1, 512, 1, 1] -- -- --
73-
├─Linear: 1-10 [1, 1000] 513,000 [512, 1000] 513,000
73+
├─Linear: 1-10 [1, 1000] 513,000 -- 513,000
7474
============================================================================================================================================
7575
Total params: 11,689,512
7676
Trainable params: 11,006,440

tests/test_output/lstm.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Layer (type (var_name)) Kernel Shape Output Shape Param # Mult-Adds
33
========================================================================================================================
44
LSTMNet -- -- -- --
5-
├─Embedding (embedding) [300, 20] [1, 100, 300] 6,000 6,000
5+
├─Embedding (embedding) -- [1, 100, 300] 6,000 6,000
66
│ └─weight [300, 20] └─6,000
77
├─LSTM (encoder) -- [1, 100, 512] 3,768,320 376,832,000
88
│ └─weight_ih_l0 [2048, 300] ├─614,400
@@ -13,7 +13,7 @@ LSTMNet -- --
1313
│ └─weight_hh_l1 [2048, 512] ├─1,048,576
1414
│ └─bias_ih_l1 [2048] ├─2,048
1515
│ └─bias_hh_l1 [2048] └─2,048
16-
├─Linear (decoder) [512, 20] [1, 100, 20] 10,260 10,260
16+
├─Linear (decoder) -- [1, 100, 20] 10,260 10,260
1717
│ └─weight [512, 20] ├─10,240
1818
│ └─bias [20] └─20
1919
========================================================================================================================

0 commit comments

Comments
 (0)