What's the best way to keep value in for loop to an array

I want to keep the value to array X, which is calculated from array Y by for loop, is it the right way as follows? Is initiallization needed for X?

X=torch.zeros(100,1)
Y=torch.randn(100,100)

k=0
for c in Y:
X[k]=myfunction( c)
k=k+1