You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hello,after I run the prune_model_imagenet.py,when i == 2 in following code, the pruned_cfg[i]=0,it means that the block has no channels to keep.
for i in range(len(pruned_cfg)):
pruned_cfg[i] = masks[counter].sum().long().item()
counter += 1
model = models.__dict__[args.arch](args.num_classes, args.expanded_inchannel, args.multiplier, pruned_cfg)
Then, the error occurs:
Traceback (most recent call last):
File "script/prune_model_imagenet.py", line 82, in
model = models.dict[args.arch](args.num_classes, args.expanded_inchannel, args.multiplier, pruned_cfg)
File "/pruning-from-scratch/models/mobilenet.py", line 227, in mobilenet_v2
return MobileNetV2(num_class, in_channel, multiplier, cfg)
File "/pruning-from-scratch/models/mobilenet.py", line 189, in init
self.features.append(InvertedResidual(inp, oup, hid, stride))
File "/pruning-from-scratch/models/mobilenet.py", line 159, in init
self.conv = InvertedBlock(inp, oup, hid, stride)
File "/pruning-from-scratch/models/mobilenet.py", line 117, in init
self.conv1 = nn.Conv2d(inp, hid, 1, 1, 0, bias=False)
File "python3.7/site-packages/torch/nn/modules/conv.py", line 338, in init
False, pair(0), groups, bias, padding_mode)
File "python3.7/site-packages/torch/nn/modules/conv.py", line 53, in init
self.reset_parameters()
File "python3.7/site-packages/torch/nn/modules/conv.py", line 56, in reset_parameters
init.kaiming_uniform(self.weight, a=math.sqrt(5))
File "python3.7/site-packages/torch/nn/init.py", line 322, in kaiming_uniform_
fan = _calculate_correct_fan(tensor, mode)
File "python3.7/site-packages/torch/nn/init.py", line 291, in _calculate_correct_fan
fan_in, fan_out = _calculate_fan_in_and_fan_out(tensor)
File "python3.7/site-packages/torch/nn/init.py", line 223, in _calculate_fan_in_and_fan_out
receptive_field_size = tensor[0][0].numel()
IndexError: index 0 is out of bounds for dimension 0 with size 0
How do I solve the problem? Thanks so much~
The text was updated successfully, but these errors were encountered:
hello,after I run the prune_model_imagenet.py,when i == 2 in following code, the pruned_cfg[i]=0,it means that the block has no channels to keep.
Then, the error occurs:
Traceback (most recent call last):
File "script/prune_model_imagenet.py", line 82, in
model = models.dict[args.arch](args.num_classes, args.expanded_inchannel, args.multiplier, pruned_cfg)
File "/pruning-from-scratch/models/mobilenet.py", line 227, in mobilenet_v2
return MobileNetV2(num_class, in_channel, multiplier, cfg)
File "/pruning-from-scratch/models/mobilenet.py", line 189, in init
self.features.append(InvertedResidual(inp, oup, hid, stride))
File "/pruning-from-scratch/models/mobilenet.py", line 159, in init
self.conv = InvertedBlock(inp, oup, hid, stride)
File "/pruning-from-scratch/models/mobilenet.py", line 117, in init
self.conv1 = nn.Conv2d(inp, hid, 1, 1, 0, bias=False)
File "python3.7/site-packages/torch/nn/modules/conv.py", line 338, in init
False, pair(0), groups, bias, padding_mode)
File "python3.7/site-packages/torch/nn/modules/conv.py", line 53, in init
self.reset_parameters()
File "python3.7/site-packages/torch/nn/modules/conv.py", line 56, in reset_parameters
init.kaiming_uniform(self.weight, a=math.sqrt(5))
File "python3.7/site-packages/torch/nn/init.py", line 322, in kaiming_uniform_
fan = _calculate_correct_fan(tensor, mode)
File "python3.7/site-packages/torch/nn/init.py", line 291, in _calculate_correct_fan
fan_in, fan_out = _calculate_fan_in_and_fan_out(tensor)
File "python3.7/site-packages/torch/nn/init.py", line 223, in _calculate_fan_in_and_fan_out
receptive_field_size = tensor[0][0].numel()
IndexError: index 0 is out of bounds for dimension 0 with size 0
How do I solve the problem? Thanks so much~
The text was updated successfully, but these errors were encountered: