!45702 [assistant][ops] Add BesselI0

Merge pull request !45702 from 王翊嘉/BesselI0
This commit is contained in:
i-robot 2023-01-05 01:41:55 +00:00 committed by Gitee
commit a9b9360fde
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 35 additions and 3 deletions

View File

@ -0,0 +1,32 @@
# Copyright 2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
"""BesselI0 op"""
from mindspore.ops.op_info_register import op_info_register, AiCPURegOp, DataType
bessel_i0_op_info = AiCPURegOp("BesselI0") \
.fusion_type("OPAQUE") \
.input(0, "x", "required") \
.output(0, "y", "required") \
.dtype_format(DataType.F16_Default, DataType.F16_Default) \
.dtype_format(DataType.F32_Default, DataType.F32_Default) \
.dtype_format(DataType.F64_Default, DataType.F64_Default) \
.get_op_info()
@op_info_register(bessel_i0_op_info)
def _bessel_i0_aicpu():
"""BesselI0 aicpu register"""
return

View File

@ -2852,7 +2852,7 @@ def bessel_i0(x):
>>> x = Tensor(np.array([-1, -0.5, 0.5, 1]), mindspore.float32)
>>> output = ops.bessel_i0(x)
>>> print(output)
[1.26606588 1.06348337 1.06348337 1.26606588]
[1.266066 1.0634835 1.0634835 1.266066]
"""
return bessel_i0_(x)

View File

@ -4961,12 +4961,12 @@ class BesselI0(Primitive):
>>> x = Tensor(np.array([0.24, 0.83, 0.31, 0.09]), mindspore.float32)
>>> output = bessel_i0(x)
>>> print(output)
[1.014452 1.179784 1.0241697 1.0020261]
[1.0144521 1.1797839 1.0241698 1.0020262]
"""
@prim_attr_register
def __init__(self):
"""Initialize BesselI0"""
self.init_prim_io_names(inputs=['x'], outputs='y')
class BesselI1(Primitive):