Is this efficient?

New to pytorch.

I have got a 1d array called A from numpy, which i’m turning into a torch tensor using torch.from_numpy(A).unsqueeze(0). Is the unsqueeze part slow?

No, it shouldn’t be slow as it should manipulate the metadata of the tensor alone if I’m not mistaken.

thanks. id read that unsqueeze doesn’t modify in place so it can be expensive but i didn’t know about htis particular situation where its a 1d array.