Solved by supriyar in post #2 
              
              
                Hi @Alexander_Soare, can you try this code out with the latest pytorch nightly build? I tried to reproduce the issue but wasn’t able to 
      class Model(nn.Module):
            def __init__(self):
                super().__init__()

            def forward(self, x):
                B = x.shape[0]
…