Dear all,
I have the following tensor:
y = (torch.rand(size=(1,81)) < 0.25).long()
how can I change the size to # Out[288]: torch.Size([81])
?
Dear all,
I have the following tensor:
y = (torch.rand(size=(1,81)) < 0.25).long()
how can I change the size to # Out[288]: torch.Size([81])
?
y
will have the shape torch.Size([1, 81])
. To remove dim0
you could use:
y = (torch.rand(size=(1,81)) < 0.25).long().squeeze(0)
Great! Thanks a lot!