Solved by vmirly1 in post #4 
              
              
                I have a solution but maybe not the most elegant one. First, let’s work with the following tensor for A to make it easier : 
>>> A = torch.tensor(np.arange(2*3*64)/10.0).reshape(2, 3, 8, 8)
>>> A.shape
torch.Size([2, 3, 8, 8])
>>> A[0, 0]
tensor([[0.0000, 0.1000, 0.2000, 0.3000, 0.4000, 0.5000, 0.60…