Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion torch/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ class _TensorBase(object):
# CUDA case, which handles constructing the tensor on the same GPU
# as this tensor.
def new(self, *args, **kwargs):
"""Constructs a new tensor of the same data type."""
"""Constructs a new tensor of the same data type.
Any valid argument combination to the Tensor constructor is accepted by
this method, including sizes, :class:`torch.Storage`, numpy ndarray,
Python Sequence, etc. See :class:`torch.Tensor` for more details.
.. note:: For CUDA tensors, this method will create new tensor on the
same device as this tensor.
"""
return self.__class__(*args, **kwargs)

def type_as(self, tensor):
Expand Down