mindspore.dtype
Data Type
- class mindspore.dtype
The actual path of dtype
is /mindspore/common/dtype.py
.
Run the following command to import the package:
import mindspore.common.dtype as mstype
or
from mindspore import dtype as mstype
Numeric Type
Currently, MindSpore supports Int
type, Uint
type and Float
type.
The following table lists the details.
Definition |
Description |
---|---|
|
8-bit integer |
|
16-bit integer |
|
32-bit integer |
|
64-bit integer |
|
unsigned 8-bit integer |
|
unsigned 16-bit integer |
|
unsigned 32-bit integer |
|
unsigned 64-bit integer |
|
16-bit floating-point number |
|
32-bit floating-point number |
|
64-bit floating-point number |
Other Type
For other defined types, see the following table.
Type |
Description |
---|---|
|
MindSpore’s |
|
A tensor only has data type and shape. |
|
Bool number. |
|
Integer scalar. |
|
Unsigned integer scalar. |
|
Floating-point scalar. |
|
Number, including |
|
List constructed by |
|
Tuple constructed by |
|
Function. Return in two ways, one returns |
|
Type of type. |
|
No matching return type, corresponding to the |
|
The value of a variable managed by embd, which is used as a key of the variable in |
|
Used to store the gradient of the free variable of a function, where the key is the |
Tree Topology
The relationships of the above types are as follows:
└─── mindspore.dtype
├─── number
│ ├─── bool_
│ ├─── int_
│ │ ├─── int8, byte
│ │ ├─── int16, short
│ │ ├─── int32, intc
│ │ └─── int64, intp
│ ├─── uint
│ │ ├─── uint8, ubyte
│ │ ├─── uint16, ushort
│ │ ├─── uint32, uintc
│ │ └─── uint64, uintp
│ └─── float_
│ ├─── float16
│ ├─── float32
│ └─── float64
├─── tensor
│ ├─── Array[float32]
│ └─── ...
├─── list_
│ ├─── List[int32,float32]
│ └─── ...
├─── tuple_
│ ├─── Tuple[int32,float32]
│ └─── ...
├─── function
│ ├─── Func
│ ├─── Func[(int32, float32), int32]
│ └─── ...
├─── MetaTensor
├─── type_type
├─── type_none
├─── symbolic_key
└─── env_type