def new(self, *args, **kwargs):
r"""Constructs a new tensor of the same data type as :attr:`self` tensor.
Any valid argument combination to the tensor constructor is accepted by
this method, including sizes, :class:`torch.Storage`, NumPy ndarray,
Python Sequence, etc. See :ref:`torch.Tensor <tensor-doc>` 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)
评论列表
文章目录