How to assign values to a Tensor by index like Numpy in python? In numpy, we can fill values to an array by index:
array = np.zeros((10, 8, 3), dtype=np.float32)
for n in range(10):
for k in range(4):
array[n, k, :] = x, y, -2 # x,y are diffrent values in every loop
array[n, 4 + k, :] = x, y, 0.4
If there is a zeros tensor using torch.zeros, how to fill values to it in Pytorch by the indexes?