[resolved] Double unsqueeze

Hi,

Is there a smart way to do: my_tensor.unsqueeze(0).unsqueeze(0) in one shot?

something like my_tensor.unsqueeze(0,1)

It’s not a big deal but if you want to had 3 fake dimensions, the code line stops to look serious

How, just my_tensor.view(1,1,-1) did it… ok sorry for the topic…

5 Likes

This flattens the -1 dimension

1 Like