mindspore.ops.custom_info_register

View Source On Gitee
mindspore.ops.custom_info_register(*reg_info)[source]

A decorator which is used to bind the registration information to the func parameter of mindspore.ops.Custom.

Note

The ‘reg_info’ will be added into oplib.

Parameters

reg_info (tuple[str, dict]) – Each item represents registration information in json format.

Returns

Function, returns a decorator for op info register.

Raises

TypeError – If reg_info is not a tuple.

Examples

>>> from mindspore.ops import custom_info_register, CustomRegOp, DataType
>>> custom_func_ascend_info = CustomRegOp() \
...     .input(0, "x", "dynamic") \
...     .output(0, "y") \
...     .dtype_format(DataType.F16_Default, DataType.F16_Default) \
...     .dtype_format(DataType.F32_Default, DataType.F32_Default) \
...     .target("Ascend") \
...     .get_op_info()
>>>
>>> @custom_info_register(custom_func_ascend_info)
... def custom_func(x):
...     pass