Hello,
I have script where I would like to reshape a tensor based on a dimension parameter dim.
Say the tensor has tensor.shape = [T].
When dim=0, this should be executed:
tensor[:,None,None] # resulting shape is [T,1,1]
when dim=1
tensor[None,:,None] # resulting shape is [1,T,1]
when dim=2
tensor[None,None,:] # resulting shape is [1,1,T]
Is there a corresponding command to do this depending on dim?
I only know unsqueeze, which only works for single dimension adding.
Thanks!
Best, JZ