Solved by ptrblck in post #2 
              
              
                I don’t think you need the nested loop, which will slow down your code. 
This should also work: 
inputTensor = torch.randn(10, 10)
outputTensor = inputTensor.clone()
for n in range(inputTensor.size(0)):
    for m in range(inputTensor.size(1)):
        outputTensor[n][m] = torch.div(inputTensor[n][m]…