Hi
Im trying to write a masked cnn layer as:
class MaskedConv1d(nn.Module):
    def __init__(self, mask_type, *args, **kwargs):
        super(MaskedConv1d, self).__init__()
        assert mask_type in ['A', 'B']
        self.conv = nn.Conv1d(args[0], args[1], args[2],
                              stride=kwargs['stride'],
                              padding=kwargs['padding'],
                              dilation=kwargs['dilation'])        
         _, _ , kw = self.conv.weight.size()
        self.conv.weight[:,:, kw // 2 + (mask_type == 'B'):] = 0
        
    def forward(self, x):        

        return self.conv(x) 

but I got the following error:
RuntimeError: output_nr_ == 0 ASSERT FAILED at /pytorch/torch/csrc/autograd/variable.cpp:196, please report a bug to PyTorch.
Can anyone help me with this?