Value Error(): Empty tensor

pytorch version 0.3

Conv2d_mask[group_index_in*g_size_out: (group_index_out + 1)g_size_out, group_index_ing_size_in:(group_index_in+1)*g_size_in, :, :] = 1.
ValueError: result of slicing is an empty tensor

May I know the reason for the following error,

I have checked the following post but I did not understand?

Could you post an executable code snippet?
Also I would suggest to upgrade PyTorch to 0.4.0 and see, if this error still occurs.

The issue has been resolved. How to initialize the convolutional weights for different instances of same model? I don’t want to use copy

Just apply the weight_init with each instance:

model1 = Net()
model1.apply(weight_init)
model2 = Net()
model2.apply(weight_init)

Or would you like use the same initialized weights?
If so, you could copy the state_dict.