How pytorch uses an implicit for loop instead of an explicit for loop?

The code is as follows:
import torch import numpy as np x = torch.zeros((128, 3, 32, 32)) y = np.arange(128) for i in range(len(y)): x[:].uniform_(-y[i], y[i])
Can the for loop be replaced with something like array slicing? Thanks

I’m not sure I understand the code correctly, since you could just use the last y value via y[-1] to initialize x. Currently you are overwriting the previously used values in x and only keep the ones from the last iteration.