提交 07d94c41 编写于 作者: M Megvii Engine Team

docs(mge/tensor): add docstring for some tensor attr

GitOrigin-RevId: f08c8c78c4da05d7a0febdcae898c4b04f78af3a
上级 554994f0
......@@ -60,8 +60,8 @@ class Tensor(_Tensor, ArrayMethodMixin):
"""
grad = None
dmap_callback = None
grad = None #: gradient of this tensor, see :mod:`~.autodiff`.
dmap_callback = None #: callback for device mapping, see :func:`~.load`.
_qparams = None
_custom_name = ""
_name = None
......@@ -122,10 +122,12 @@ class Tensor(_Tensor, ArrayMethodMixin):
@property
def format(self) -> str:
r"""Returns a string represents the :ref:`memory format <format-introduction>` of a :class:`~.Tensor`."""
return super().format()
@format.setter
def format(self, format):
r"""Sets the memory format of a :class:`~.Tensor`."""
super()._set_format(format)
@property
......@@ -161,6 +163,7 @@ class Tensor(_Tensor, ArrayMethodMixin):
@property
def name(self):
r"""Returns a string represents the name of a :class:`~.Tensor`."""
return self._custom_name
@name.setter
......@@ -195,6 +198,7 @@ class Tensor(_Tensor, ArrayMethodMixin):
@property
def requires_grad(self):
r"""Returns a bool indicates whether the :class:`~.Tensor` requires gradient."""
raise AttributeError("requires_grad is reserved for future use")
@requires_grad.setter
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册