From 07d94c41ac22eea0989cd2626cd556fc584e121e Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Wed, 14 Sep 2022 16:24:43 +0800 Subject: [PATCH] docs(mge/tensor): add docstring for some tensor attr GitOrigin-RevId: f08c8c78c4da05d7a0febdcae898c4b04f78af3a --- imperative/python/megengine/tensor.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/imperative/python/megengine/tensor.py b/imperative/python/megengine/tensor.py index ccc7e29a6..2e8a1ed8f 100644 --- a/imperative/python/megengine/tensor.py +++ b/imperative/python/megengine/tensor.py @@ -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 ` 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 -- GitLab