how to initialize Tensor for torch.cat
import torch

#Y_pred = ?

for xi in X_iter:
    y_pred = net(xi).argmax(dim=1)
    Y_pred = torch.cat([Y_pred, y_pred])


How do you initialize this tensor, or is there a better way to write it？

You could do this instead:

Y_pred = torch.cat([net(xi).argmax(dim=1) for xi in X_iter])

