Browse Source

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

GitOrigin-RevId: f08c8c78c4
release-1.11.1
Megvii Engine Team 2 years ago
parent
commit
07d94c41ac
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      imperative/python/megengine/tensor.py

+ 6
- 2
imperative/python/megengine/tensor.py View File

@@ -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


Loading…
Cancel
Save