-
|
continuous_dims = { Above is the definition of continuous_dim in imagnet.py . The question is, what are the criteria for determining continuous_dim. Described as continuous_dim performing the crop. If so, do I have to choose all the parts that correspond to the last layer before entering the fully connected layer? Additionally, in the example above, that's how it works Model = resnet18 (pre-training = true) Specify continuous dimensions to cut Converting to an integrated model The choice of continuous_dims is slightly different here. I would appreciate it if you could tell me the difference between these two as well. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
In this dict you should specify parameter names and axes of corresponding tensors which you want to make continuous for further pruning. Thus, if you want to prune convolution layer4.0.conv1 along output dimension you should add {'layer4.0.conv1.weight': [0]} to the continuous_dims dict. If input channels dimension of the this convolution layer is also pruned, then {'layer4.0.conv1.weight': [0, 1]} is used. If the question is why do we prune these layers, it is just heuristic that last layers is easier to prune. If you want to reproduce imagenet experiments use definition of continuous_dim in imagnet.py, else you can choose any layers you want. |
Beta Was this translation helpful? Give feedback.
In this dict you should specify parameter names and axes of corresponding tensors which you want to make continuous for further pruning. Thus, if you want to prune convolution layer4.0.conv1 along output dimension you should add {'layer4.0.conv1.weight': [0]} to the continuous_dims dict. If input channels dimension of the this convolution layer is also pruned, then {'layer4.0.conv1.weight': [0, 1]} is used.
Note that bias parameter of convolution layer must have the same sampling grid as weight parameter along out channels, but it is not necessary to list biases in continuous_dims, because torch_integral.graph module automatically detects such related tensors.
If the question is why do we…