0
votes

When I do print("action shape:, ", action.shape) for my tensor action I got (64,). It is the same as (1, 64)? And how do I reshape its size to (64,1)?

1

1 Answers

2
votes

Technically it is not the same shape and in pytorch you will get an error if you have things that need a shape of (64,) but you give it (1,64) but it is easy to change it to (64,) by squeezing it. To reshape it to a size of (64, 1) you can do this

action = action.unsqueeze(1)
# or
action = action.view(-1, 1)

either will work but I would recommend the first one.