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