I have a
which is a tensor object with shape (3, )
.
I have b
which is a tensor object with shape either []
(scalar) or (2, )
.
I want to concatenate a
and b
into a single vector of length (4, )
or (5, )
.
It seems that torch.cat
or torch.stack
will fail doing so.
Is there other one liner option to do without if
to handle the case of the scalar?