.view(-1) flattens a tensor in PyTorch. What’s the difference?
.flatten() copy data of the tensor?
- Is there any situation that
.flatten() doesn’t work?
I’ve tried to read PyTorch’s docs but it doesn’t answer these questions.
view ( *shape ) → Tensor
Returns a new tensor with the same data as the
self tensor but of a different
flatten ( input , start_dim=0 , end_dim=-1 ) → Tensor
Flattens a contiguous range of dims in a tensor.
Well I read those descriptions on the docs but they didn’t answer my questions.