mindspore.pytype_to_dtype

查看源文件
mindspore.pytype_to_dtype(obj)[源代码]

将Python数据类型转换为MindSpore数据类型。

参数:
  • obj (type) - Python数据对象。

返回:

MindSpore的数据类型。

异常:
  • NotImplementedError - Python类型无法转换为MindSpore类型。

样例:

>>> import mindspore as ms
>>> out = ms.pytype_to_dtype(bool)
>>> print(out)
Bool