Browse Source

docs(mge/tensor): add dtype and device doc ref for typehint result

GitOrigin-RevId: a9adb93889
release-1.11.1
Megvii Engine Team 2 years ago
parent
commit
36d3c2ac58
1 changed files with 9 additions and 3 deletions
  1. +9
    -3
      imperative/python/megengine/tensor.py

+ 9
- 3
imperative/python/megengine/tensor.py View File

@@ -111,13 +111,19 @@ class Tensor(_Tensor, ArrayMethodMixin):
return super().shape return super().shape


@property @property
def device(self) -> CompNode:
r"""Returns a string represents the device a :class:`~.Tensor` storaged on."""
def device(self):
r"""Returns a string represents the device a :class:`~.Tensor` storaged on.
.. seealso:: see :ref:`tensor-device` for more details.
"""
return super().device return super().device


@property @property
def dtype(self) -> np.dtype: def dtype(self) -> np.dtype:
r"""Returns a :class:`numpy.dtype` object represents the data type of a :class:`~.Tensor`."""
r"""Returns a :class:`numpy.dtype` object represents the data type of a :class:`~.Tensor`.
.. seealso:: see :ref:`tensor-dtype` for more details.
"""
return super().dtype return super().dtype


@property @property


Loading…
Cancel
Save