Skip to content
Advertisement

Tag: pytorch

What does .view() do in PyTorch?

What does .view() do to a tensor x? What do negative values mean? Answer view() reshapes the tensor without copying memory, similar to numpy’s reshape(). Given a tensor a with 16 elements: To reshape this tensor to make it a 4 x 4 tensor, use: Now a will be a 4 x 4 tensor. Note that after the reshape the

Advertisement