A simple CNN with Pytorch - Tom Roth
https://tomroth.com.au/pytorch-cnnFor example, if x is given by a 16x1 tensor. x.view(4,4) reshapes it to a 4x4 tensor. You can write -1 to infer the dimension on that axis, based on the number of elements in x and the shape of the other axes. For example, x.view(2,-1) returns a Tensor of shape 2x8. Only one axis can be inferred.
A simple CNN with Pytorch - Tom Roth
tomroth.com.au › pytorch-cnnApr 14, 2020 · For example, if x is given by a 16x1 tensor. x.view(4,4) reshapes it to a 4x4 tensor. You can write -1 to infer the dimension on that axis, based on the number of elements in x and the shape of the other axes. For example, x.view(2,-1) returns a Tensor of shape 2x8. Only one axis can be inferred.