Thanks for the update.
Based on your provided code you could use broadcasting and multiply the input tensor as:
T = torch.ones(3,3)

for i in range(3):
    for j in range(3):
        T[i][j] = j*i

print(T)
> tensor([[0., 0., 0.],
          [0., 1., 2.],
          [0., 2., 4.]])

a = torch.arange(3)
res = a * a.unsqueeze(1)
print(res)
> tensor([[0, 0, 0],
          [0, 1, 2],
          [0, 2, 4]])

a = torch.arange(100)
res = a * a.unsqueeze(1)
print(res)
> tensor([[   0,    0,    0,  ...,    0,    0,    0],
          [   0,    1,    2,  ...,   97,   98,   99],
          [   0,    2,    4,  ...,  194,  196,  198],
          ...,
          [   0,   97,  194,  ..., 9409, 9506, 9603],
          [   0,   98,  196,  ..., 9506, 9604, 9702],
          [   0,   99,  198,  ..., 9603, 9702, 9801]])