diff --git a/api/source_en/api/python/mindspore/mindspore.dtype.rst b/api/source_en/api/python/mindspore/mindspore.dtype.rst index ab38ead244cd2fc5eb03fbb68ee87a4f36da766c..950ac84f89284e3283c1b64c410405d2de7a4fcd 100644 --- a/api/source_en/api/python/mindspore/mindspore.dtype.rst +++ b/api/source_en/api/python/mindspore/mindspore.dtype.rst @@ -6,13 +6,14 @@ Data Type .. class:: mindspore.dtype +Create a data type object The actual path of ``dtype`` is ``/mindspore/common/dtype.py``. Run the following command to import the package: .. code-block:: import mindspore.common.dtype as mstype - + or .. code-block:: @@ -29,7 +30,7 @@ The following table lists the details. Definition Description ============================================== ============================= ``mindspore.int8`` , ``mindspore.byte`` 8-bit integer -``mindspore.int16`` , ``mindspore.short`` 16-bit integer +``mindspore.int16`` , ``mindspore.short`` 16-bit integer ``mindspore.int32`` , ``mindspore.intc`` 32-bit integer ``mindspore.int64`` , ``mindspore.intp`` 64-bit integer ``mindspore.uint8`` , ``mindspore.ubyte`` unsigned 8-bit integer @@ -49,19 +50,19 @@ For other defined types, see the following table. ============================ ================= Type Description ============================ ================= -``tensor`` MindSpore's ``tensor`` type. Data format uses NCHW. -``MetaTensor`` A tensor only has data type and shape. -``bool_`` Bool number. +``tensor`` MindSpore's ``tensor`` type. Data format uses NCHW. For details, see [tensor](https://gitee.com/mindspore/mindspore/blob/master/mindspore/common/tensor.py) +``MetaTensor`` A tensor only has data type and shape. For details, see [MetaTensor](https://gitee.com/mindspore/mindspore/blob/master/mindspore/common/parameter.py) +``bool_`` Boolean ``True`` or ``False``. ``int_`` Integer scalar. ``uint`` Unsigned integer scalar. ``float_`` Floating-point scalar. ``number`` Number, including ``int_`` , ``uint`` , ``float_`` and ``bool_`` . ``list_`` List constructed by ``tensor`` , such as ``List[T0,T1,...,Tn]`` , where the element ``Ti`` can be of different types. ``tuple_`` Tuple constructed by ``tensor`` , such as ``Tuple[T0,T1,...,Tn]`` , where the element ``Ti`` can be of different types. -``function`` Function. Return in two ways, one returns ``Func`` directly, the other returns ``Func(args: List[T0,T1,...,Tn], retval: T)`` . -``type_type`` Type of type. +``function`` Function, when ``function`` is not None, returns a callable function that will execute the compiled function; When ``function`` is None, returns a decorator and when this decorator invokes with a single ``function`` argument, the callable function is equal to the case when ``function`` is not None. +``type_type`` Type definition of ``type``. ``type_none`` No matching return type, corresponding to the ``type(None)`` in Python. -``symbolic_key`` The value of a variable managed by embd, which is used as a key of the variable in ``env_type`` . +``symbolic_key`` The value of a variable is used as a key of the variable in ``env_type`` . ``env_type`` Used to store the gradient of the free variable of a function, where the key is the ``symbolic_key`` of the free variable's node and the value is the gradient. ============================ ================= @@ -73,7 +74,8 @@ The relationships of the above types are as follows: .. code-block:: - └─────── number + └─── mindspore.dtype + ├─── number │ ├─── bool_ │ ├─── int_ │ │ ├─── int8, byte @@ -90,17 +92,17 @@ The relationships of the above types are as follows: │ ├─── float32 │ └─── float64 ├─── tensor - │ ├─── Array[Float32] + │ ├─── Array[float32] │ └─── ... ├─── list_ - │ ├─── List[Int32,Float32] + │ ├─── List[int32,float32] │ └─── ... ├─── tuple_ - │ ├─── Tuple[Int32,Float32] + │ ├─── Tuple[int32,float32] │ └─── ... ├─── function │ ├─── Func - │ ├─── Func[(Int32, Float32), Int32] + │ ├─── Func[(int32, float32), int32] │ └─── ... ├─── MetaTensor ├─── type_type diff --git a/api/source_zh_cn/api/python/mindspore/mindspore.dtype.rst b/api/source_zh_cn/api/python/mindspore/mindspore.dtype.rst index 8474d596a6fa78419e6f457eb7147b18dce0e9a8..950ac84f89284e3283c1b64c410405d2de7a4fcd 100644 --- a/api/source_zh_cn/api/python/mindspore/mindspore.dtype.rst +++ b/api/source_zh_cn/api/python/mindspore/mindspore.dtype.rst @@ -6,13 +6,14 @@ Data Type .. class:: mindspore.dtype +Create a data type object The actual path of ``dtype`` is ``/mindspore/common/dtype.py``. Run the following command to import the package: .. code-block:: import mindspore.common.dtype as mstype - + or .. code-block:: @@ -29,7 +30,7 @@ The following table lists the details. Definition Description ============================================== ============================= ``mindspore.int8`` , ``mindspore.byte`` 8-bit integer -``mindspore.int16`` , ``mindspore.short`` 16-bit integer +``mindspore.int16`` , ``mindspore.short`` 16-bit integer ``mindspore.int32`` , ``mindspore.intc`` 32-bit integer ``mindspore.int64`` , ``mindspore.intp`` 64-bit integer ``mindspore.uint8`` , ``mindspore.ubyte`` unsigned 8-bit integer @@ -49,19 +50,19 @@ For other defined types, see the following table. ============================ ================= Type Description ============================ ================= -``tensor`` MindSpore's ``tensor`` type. Data format uses NCHW. -``MetaTensor`` A tensor only has data type and shape. -``bool_`` Bool number. +``tensor`` MindSpore's ``tensor`` type. Data format uses NCHW. For details, see [tensor](https://gitee.com/mindspore/mindspore/blob/master/mindspore/common/tensor.py) +``MetaTensor`` A tensor only has data type and shape. For details, see [MetaTensor](https://gitee.com/mindspore/mindspore/blob/master/mindspore/common/parameter.py) +``bool_`` Boolean ``True`` or ``False``. ``int_`` Integer scalar. ``uint`` Unsigned integer scalar. ``float_`` Floating-point scalar. ``number`` Number, including ``int_`` , ``uint`` , ``float_`` and ``bool_`` . ``list_`` List constructed by ``tensor`` , such as ``List[T0,T1,...,Tn]`` , where the element ``Ti`` can be of different types. ``tuple_`` Tuple constructed by ``tensor`` , such as ``Tuple[T0,T1,...,Tn]`` , where the element ``Ti`` can be of different types. -``function`` Function. Return in two ways, one returns ``Func`` directly, the other returns ``Func(args: List[T0,T1,...,Tn], retval: T)`` . -``type_type`` Type of type. +``function`` Function, when ``function`` is not None, returns a callable function that will execute the compiled function; When ``function`` is None, returns a decorator and when this decorator invokes with a single ``function`` argument, the callable function is equal to the case when ``function`` is not None. +``type_type`` Type definition of ``type``. ``type_none`` No matching return type, corresponding to the ``type(None)`` in Python. -``symbolic_key`` The value of a variable managed by embd, which is used as a key of the variable in ``env_type`` . +``symbolic_key`` The value of a variable is used as a key of the variable in ``env_type`` . ``env_type`` Used to store the gradient of the free variable of a function, where the key is the ``symbolic_key`` of the free variable's node and the value is the gradient. ============================ =================