reshape

Documentation

class treetensor.torch.Tensor(data, *args, **kwargs)[source]
reshape(*args, **kwargs)[source]

See treetensor.torch.reshape().

Torch Version Related

This documentation is based on torch.Tensor.reshape in torch v2.4.1+cu121. Its arguments’ arrangements depend on the version of pytorch you installed.

If some arguments listed here are not working properly, please check your pytorch’s version with the following command and find its documentation.

1
python -c 'import torch;print(torch.__version__)'

The arguments and keyword arguments supported in torch v2.4.1+cu121 is listed below.

Description From Torch v2.4.1+cu121

class torch.Tensor
reshape(*shape)Tensor

Returns a tensor with the same data and number of elements as self but with the specified shape. This method returns a view if shape is compatible with the current shape. See torch.Tensor.view() on when it is possible to return a view.

See torch.reshape()

Args:

shape (tuple of ints or int…): the desired shape