Since akg supports both Ascend and Gpu, but their supported type and format are different, so we use two directory "ascend" and "gpu" to store their registers respectively, and use an attribute "processor" to distinguish them. Main changes: 1) Add two op register class "AkgAscendRegOp" and "AkgGpuRegOp", inherited from the original AkgRegOp. 2) Rewrite akg ascend op registers with new interface, move them into directory "ascend". 3) Rename the imply_type from "AutoDiff" to "AKG". 4) Modify function FindOp, check the processor when imply_type is "AKG". 5) Modify function CheckRepetition, remove the judgement for impl_path, check processor instead. TODO: Remove op registers in akg root path.pull/3032/head
parent
49da4e799c
commit
78f35814d5
@ -0,0 +1,30 @@
|
||||
# Copyright 2020 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.
|
||||
|
||||
"""__init__"""
|
||||
|
||||
from .add import _add_akg
|
||||
from .batchmatmul import _batchmatmul_akg
|
||||
from .cast import _cast_akg
|
||||
from .expand_dims import _expand_dims_akg
|
||||
from .greater import _greater_akg
|
||||
from .inplace_assign import _inplace_assign_akg
|
||||
from .maximum import _maximum_akg
|
||||
from .minimum import _minimum_akg
|
||||
from .mul import _mul_akg
|
||||
from .real_div import _real_div_akg
|
||||
from .rsqrt import _rsqrt_akg
|
||||
from .select import _select_akg
|
||||
from .sqrt import _sqrt_akg
|
||||
from .sub import _sub_akg
|
@ -0,0 +1,42 @@
|
||||
# Copyright 2020 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.
|
||||
# ============================================================================
|
||||
|
||||
"""TensorAdd op"""
|
||||
from mindspore.ops.op_info_register import op_info_register, AkgAscendRegOp, DataType as DT
|
||||
|
||||
op_info = AkgAscendRegOp("TensorAdd") \
|
||||
.fusion_type("ELEMWISE") \
|
||||
.input(0, "x") \
|
||||
.input(1, "y") \
|
||||
.output(0, "output") \
|
||||
.dtype_format(DT.F16_Default, DT.F16_Default, DT.F16_Default) \
|
||||
.dtype_format(DT.F32_Default, DT.F32_Default, DT.F32_Default) \
|
||||
.dtype_format(DT.I32_Default, DT.I32_Default, DT.I32_Default) \
|
||||
.dtype_format(DT.F16_5HD, DT.F16_5HD, DT.F16_5HD) \
|
||||
.dtype_format(DT.F32_5HD, DT.F32_5HD, DT.F32_5HD) \
|
||||
.dtype_format(DT.I32_5HD, DT.I32_5HD, DT.I32_5HD) \
|
||||
.dtype_format(DT.F16_FracZ, DT.F16_FracZ, DT.F16_FracZ) \
|
||||
.dtype_format(DT.F32_FracZ, DT.F32_FracZ, DT.F32_FracZ) \
|
||||
.dtype_format(DT.I32_FracZ, DT.I32_FracZ, DT.I32_FracZ) \
|
||||
.dtype_format(DT.F16_FracNZ, DT.F16_FracNZ, DT.F16_FracNZ) \
|
||||
.dtype_format(DT.F32_FracNZ, DT.F32_FracNZ, DT.F32_FracNZ) \
|
||||
.dtype_format(DT.I32_FracNZ, DT.I32_FracNZ, DT.I32_FracNZ) \
|
||||
.get_op_info()
|
||||
|
||||
|
||||
@op_info_register(op_info)
|
||||
def _add_akg():
|
||||
"""TensorAdd Akg register"""
|
||||
return
|
@ -0,0 +1,33 @@
|
||||
# Copyright 2020 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.
|
||||
# ============================================================================
|
||||
|
||||
"""BatchMatMul op"""
|
||||
from mindspore.ops.op_info_register import op_info_register, AkgAscendRegOp, DataType as DT
|
||||
|
||||
op_info = AkgAscendRegOp("BatchMatMul") \
|
||||
.fusion_type("OPAQUE") \
|
||||
.input(0, "x1") \
|
||||
.input(1, "x2") \
|
||||
.output(0, "output") \
|
||||
.attr("transpose_a", "optional", "bool") \
|
||||
.attr("transpose_b", "optional", "bool") \
|
||||
.dtype_format(DT.F16_FracNZ, DT.F16_FracNZ, DT.F16_FracNZ) \
|
||||
.get_op_info()
|
||||
|
||||
|
||||
@op_info_register(op_info)
|
||||
def _batchmatmul_akg():
|
||||
"""BatchMatMul AKG register"""
|
||||
return
|
@ -0,0 +1,46 @@
|
||||
# Copyright 2020 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.
|
||||
|
||||
"""Cast op"""
|
||||
from mindspore.ops.op_info_register import op_info_register, AkgAscendRegOp, DataType as DT
|
||||
|
||||
op_info = AkgAscendRegOp("Cast") \
|
||||
.fusion_type("OPAQUE") \
|
||||
.input(0, "x") \
|
||||
.output(0, "output") \
|
||||
.attr("dst_type", "required", "str") \
|
||||
.dtype_format(DT.F16_Default, DT.F32_Default) \
|
||||
.dtype_format(DT.F16_Default, DT.I32_Default) \
|
||||
.dtype_format(DT.F32_Default, DT.F16_Default) \
|
||||
.dtype_format(DT.F32_Default, DT.I32_Default) \
|
||||
.dtype_format(DT.I32_Default, DT.F16_Default) \
|
||||
.dtype_format(DT.I32_Default, DT.F32_Default) \
|
||||
.dtype_format(DT.BOOL_Default, DT.F16_Default) \
|
||||
.dtype_format(DT.BOOL_Default, DT.F32_Default) \
|
||||
.dtype_format(DT.BOOL_Default, DT.I32_Default) \
|
||||
.dtype_format(DT.F16_5HD, DT.F32_5HD) \
|
||||
.dtype_format(DT.F32_5HD, DT.F16_5HD) \
|
||||
.dtype_format(DT.BOOL_5HD, DT.I32_5HD) \
|
||||
.dtype_format(DT.BOOL_5HD, DT.F32_5HD) \
|
||||
.dtype_format(DT.F16_FracNZ, DT.F32_FracNZ) \
|
||||
.dtype_format(DT.F32_FracNZ, DT.F16_FracNZ) \
|
||||
.dtype_format(DT.BOOL_FracNZ, DT.I32_FracNZ) \
|
||||
.dtype_format(DT.BOOL_FracNZ, DT.F32_FracNZ) \
|
||||
.get_op_info()
|
||||
|
||||
|
||||
@op_info_register(op_info)
|
||||
def _cast_akg():
|
||||
"""Cast Akg register"""
|
||||
return
|
@ -0,0 +1,33 @@
|
||||
# Copyright 2020 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.
|
||||
# ============================================================================
|
||||
|
||||
"""ExpandDims op"""
|
||||
from mindspore.ops.op_info_register import op_info_register, AkgAscendRegOp, DataType as DT
|
||||
|
||||
op_info = AkgAscendRegOp("ExpandDims") \
|
||||
.fusion_type("OPAQUE") \
|
||||
.input(0, "x") \
|
||||
.output(0, "y") \
|
||||
.attr("axis", "required", "int") \
|
||||
.dtype_format(DT.F16_Default, DT.F16_Default) \
|
||||
.dtype_format(DT.F32_Default, DT.F32_Default) \
|
||||
.dtype_format(DT.I32_Default, DT.I32_Default) \
|
||||
.get_op_info()
|
||||
|
||||
|
||||
@op_info_register(op_info)
|
||||
def _expand_dims_akg():
|
||||
"""ExpandDims Akg register"""
|
||||
return
|
@ -0,0 +1,34 @@
|
||||
# Copyright 2020 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.
|
||||
# ============================================================================
|
||||
|
||||
"""Greater op"""
|
||||
from mindspore.ops.op_info_register import op_info_register, AkgAscendRegOp, DataType as DT
|
||||
|
||||
op_info = AkgAscendRegOp("Greater") \
|
||||
.fusion_type("ELEMWISE") \
|
||||
.input(0, "x") \
|
||||
.input(1, "y") \
|
||||
.output(0, "output") \
|
||||
.dtype_format(DT.F16_Default, DT.F16_Default, DT.BOOL_Default) \
|
||||
.dtype_format(DT.F32_Default, DT.F32_Default, DT.BOOL_Default) \
|
||||
.dtype_format(DT.F16_5HD, DT.F16_5HD, DT.BOOL_5HD) \
|
||||
.dtype_format(DT.F32_5HD, DT.F32_5HD, DT.BOOL_5HD) \
|
||||
.get_op_info()
|
||||
|
||||
|
||||
@op_info_register(op_info)
|
||||
def _greater_akg():
|
||||
"""Greater Akg register"""
|
||||
return
|
@ -0,0 +1,41 @@
|
||||
# Copyright 2020 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.
|
||||
# ============================================================================
|
||||
|
||||
"""InplaceAssign op"""
|
||||
from mindspore.ops.op_info_register import op_info_register, AkgAscendRegOp, DataType as DT
|
||||
|
||||
op_info = AkgAscendRegOp("InplaceAssign") \
|
||||
.fusion_type("ELEMWISE") \
|
||||
.input(0, "x") \
|
||||
.input(1, "y") \
|
||||
.input(2, "z") \
|
||||
.output(0, "output") \
|
||||
.attr("fake_output", "optional", "bool") \
|
||||
.dtype_format(DT.F16_Default, DT.F16_Default, DT.F16_Default, DT.F16_Default) \
|
||||
.dtype_format(DT.F32_Default, DT.F32_Default, DT.F32_Default, DT.F32_Default) \
|
||||
.dtype_format(DT.I32_Default, DT.I32_Default, DT.I32_Default, DT.I32_Default) \
|
||||
.dtype_format(DT.F16_5HD, DT.F16_5HD, DT.F16_5HD, DT.F16_5HD) \
|
||||
.dtype_format(DT.F32_5HD, DT.F32_5HD, DT.F32_5HD, DT.F32_5HD) \
|
||||
.dtype_format(DT.I32_5HD, DT.I32_5HD, DT.I32_5HD, DT.I32_5HD) \
|
||||
.dtype_format(DT.F16_FracZ, DT.F16_FracZ, DT.F16_FracZ, DT.F16_FracZ) \
|
||||
.dtype_format(DT.F32_FracZ, DT.F32_FracZ, DT.F32_FracZ, DT.F32_FracZ) \
|
||||
.dtype_format(DT.I32_FracZ, DT.I32_FracZ, DT.I32_FracZ, DT.I32_FracZ) \
|
||||
.get_op_info()
|
||||
|
||||
|
||||
@op_info_register(op_info)
|
||||
def _inplace_assign_akg():
|
||||
"""InplaceAssign Akg register"""
|
||||
return
|
@ -0,0 +1,36 @@
|
||||
# Copyright 2020 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.
|
||||
# ============================================================================
|
||||
|
||||
"""Maximum op"""
|
||||
from mindspore.ops.op_info_register import op_info_register, AkgAscendRegOp, DataType as DT
|
||||
|
||||
op_info = AkgAscendRegOp("Maximum") \
|
||||
.fusion_type("COMMREDUCE") \
|
||||
.input(0, "x") \
|
||||
.input(1, "y") \
|
||||
.output(0, "output") \
|
||||
.dtype_format(DT.F16_Default, DT.F16_Default, DT.F16_Default) \
|
||||
.dtype_format(DT.F32_Default, DT.F32_Default, DT.F32_Default) \
|
||||
.dtype_format(DT.I32_Default, DT.I32_Default, DT.I32_Default) \
|
||||
.dtype_format(DT.F16_5HD, DT.F16_5HD, DT.F16_5HD) \
|
||||
.dtype_format(DT.F32_5HD, DT.F32_5HD, DT.F32_5HD) \
|
||||
.dtype_format(DT.I32_5HD, DT.I32_5HD, DT.I32_5HD) \
|
||||
.get_op_info()
|
||||
|
||||
|
||||
@op_info_register(op_info)
|
||||
def _maximum_akg():
|
||||
"""Maximum Akg register"""
|
||||
return
|
@ -0,0 +1,39 @@
|
||||
# Copyright 2020 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.
|
||||
# ============================================================================
|
||||
|
||||
"""Minimum op"""
|
||||
from mindspore.ops.op_info_register import op_info_register, AkgAscendRegOp, DataType as DT
|
||||
|
||||
op_info = AkgAscendRegOp("Minimum") \
|
||||
.fusion_type("COMMREDUCE") \
|
||||
.input(0, "x") \
|
||||
.input(1, "y") \
|
||||
.output(0, "output") \
|
||||
.dtype_format(DT.F16_Default, DT.F16_Default, DT.F16_Default) \
|
||||
.dtype_format(DT.F32_Default, DT.F32_Default, DT.F32_Default) \
|
||||
.dtype_format(DT.I32_Default, DT.I32_Default, DT.I32_Default) \
|
||||
.dtype_format(DT.F16_5HD, DT.F16_5HD, DT.F16_5HD) \
|
||||
.dtype_format(DT.F32_5HD, DT.F32_5HD, DT.F32_5HD) \
|
||||
.dtype_format(DT.I32_5HD, DT.I32_5HD, DT.I32_5HD) \
|
||||
.dtype_format(DT.F16_FracNZ, DT.F16_FracNZ, DT.F16_FracNZ) \
|
||||
.dtype_format(DT.F32_FracNZ, DT.F32_FracNZ, DT.F32_FracNZ) \
|
||||
.dtype_format(DT.I32_FracNZ, DT.I32_FracNZ, DT.I32_FracNZ) \
|
||||
.get_op_info()
|
||||
|
||||
|
||||
@op_info_register(op_info)
|
||||
def _minimum_akg():
|
||||
"""Minimum Akg register"""
|
||||
return
|
@ -0,0 +1,41 @@
|
||||
# Copyright 2020 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.
|
||||
# ============================================================================
|
||||
|
||||
"""Mul op"""
|
||||
from mindspore.ops.op_info_register import op_info_register, AkgAscendRegOp, DataType as DT
|
||||
|
||||
op_info = AkgAscendRegOp("Mul") \
|
||||
.fusion_type("ELEMWISE") \
|
||||
.input(0, "x") \
|
||||
.input(1, "y") \
|
||||
.output(0, "output") \
|
||||
.attr("x_shape", "required", "listInt") \
|
||||
.attr("y_shape", "required", "listInt") \
|
||||
.attr("data_format", "required", "listStr") \
|
||||
.dtype_format(DT.F16_Default, DT.F16_Default, DT.F16_Default) \
|
||||
.dtype_format(DT.F32_Default, DT.F32_Default, DT.F32_Default) \
|
||||
.dtype_format(DT.F16_5HD, DT.F16_5HD, DT.F16_5HD) \
|
||||
.dtype_format(DT.F32_5HD, DT.F32_5HD, DT.F32_5HD) \
|
||||
.dtype_format(DT.F16_FracZ, DT.F16_FracZ, DT.F16_FracZ) \
|
||||
.dtype_format(DT.F32_FracZ, DT.F32_FracZ, DT.F32_FracZ) \
|
||||
.dtype_format(DT.F16_FracNZ, DT.F16_FracNZ, DT.F16_FracNZ) \
|
||||
.dtype_format(DT.F32_FracNZ, DT.F32_FracNZ, DT.F32_FracNZ) \
|
||||
.get_op_info()
|
||||
|
||||
|
||||
@op_info_register(op_info)
|
||||
def _mul_akg():
|
||||
"""Mul Akg register"""
|
||||
return
|
@ -0,0 +1,36 @@
|
||||
# Copyright 2020 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.
|
||||
# ============================================================================
|
||||
|
||||
"""RealDiv op"""
|
||||
from mindspore.ops.op_info_register import op_info_register, AkgAscendRegOp, DataType as DT
|
||||
|
||||
op_info = AkgAscendRegOp("RealDiv") \
|
||||
.fusion_type("ELEMWISE") \
|
||||
.input(0, "x") \
|
||||
.input(1, "y") \
|
||||
.output(0, "output") \
|
||||
.dtype_format(DT.F16_Default, DT.F16_Default, DT.F16_Default) \
|
||||
.dtype_format(DT.F32_Default, DT.F32_Default, DT.F32_Default) \
|
||||
.dtype_format(DT.F16_5HD, DT.F16_5HD, DT.F16_5HD) \
|
||||
.dtype_format(DT.F32_5HD, DT.F32_5HD, DT.F32_5HD) \
|
||||
.dtype_format(DT.F16_FracNZ, DT.F16_FracNZ, DT.F16_FracNZ) \
|
||||
.dtype_format(DT.F32_FracNZ, DT.F32_FracNZ, DT.F32_FracNZ) \
|
||||
.get_op_info()
|
||||
|
||||
|
||||
@op_info_register(op_info)
|
||||
def _real_div_akg():
|
||||
"""RealDiv Akg register"""
|
||||
return
|
@ -0,0 +1,35 @@
|
||||
# Copyright 2020 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.
|
||||
# ============================================================================
|
||||
|
||||
"""Rsqrt op"""
|
||||
from mindspore.ops.op_info_register import op_info_register, AkgAscendRegOp, DataType as DT
|
||||
|
||||
op_info = AkgAscendRegOp("Rsqrt") \
|
||||
.fusion_type("ELEMWISE") \
|
||||
.input(0, "x") \
|
||||
.output(0, "output") \
|
||||
.dtype_format(DT.F16_Default, DT.F16_Default) \
|
||||
.dtype_format(DT.F32_Default, DT.F32_Default) \
|
||||
.dtype_format(DT.I32_Default, DT.I32_Default) \
|
||||
.dtype_format(DT.F16_5HD, DT.F16_5HD) \
|
||||
.dtype_format(DT.F32_5HD, DT.F32_5HD) \
|
||||
.dtype_format(DT.I32_5HD, DT.I32_5HD) \
|
||||
.get_op_info()
|
||||
|
||||
|
||||
@op_info_register(op_info)
|
||||
def _rsqrt_akg():
|
||||
"""Rsqrt Akg register"""
|
||||
return
|
@ -0,0 +1,37 @@
|
||||
# Copyright 2020 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.
|
||||
# ============================================================================
|
||||
|
||||
"""Select op"""
|
||||
from mindspore.ops.op_info_register import op_info_register, AkgAscendRegOp, DataType as DT
|
||||
|
||||
op_info = AkgAscendRegOp("Select") \
|
||||
.fusion_type("ELEMWISE") \
|
||||
.input(0, "condition") \
|
||||
.input(1, "x") \
|
||||
.input(2, "y") \
|
||||
.output(0, "output") \
|
||||
.dtype_format(DT.BOOL_Default, DT.F16_Default, DT.F16_Default, DT.F16_Default) \
|
||||
.dtype_format(DT.BOOL_Default, DT.F32_Default, DT.F32_Default, DT.F32_Default) \
|
||||
.dtype_format(DT.BOOL_Default, DT.I32_Default, DT.I32_Default, DT.I32_Default) \
|
||||
.dtype_format(DT.BOOL_5HD, DT.F16_5HD, DT.F16_5HD, DT.F16_5HD) \
|
||||
.dtype_format(DT.BOOL_5HD, DT.F32_5HD, DT.F32_5HD, DT.F32_5HD) \
|
||||
.dtype_format(DT.BOOL_5HD, DT.I32_5HD, DT.I32_5HD, DT.I32_5HD) \
|
||||
.get_op_info()
|
||||
|
||||
|
||||
@op_info_register(op_info)
|
||||
def _select_akg():
|
||||
"""Select Akg register"""
|
||||
return
|
@ -0,0 +1,35 @@
|
||||
# Copyright 2020 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.
|
||||
# ============================================================================
|
||||
|
||||
"""Sqrt op"""
|
||||
from mindspore.ops.op_info_register import op_info_register, AkgAscendRegOp, DataType as DT
|
||||
|
||||
op_info = AkgAscendRegOp("Sqrt") \
|
||||
.fusion_type("ELEMWISE") \
|
||||
.input(0, "x") \
|
||||
.output(0, "output") \
|
||||
.dtype_format(DT.F16_Default, DT.F16_Default) \
|
||||
.dtype_format(DT.F32_Default, DT.F32_Default) \
|
||||
.dtype_format(DT.I32_Default, DT.I32_Default) \
|
||||
.dtype_format(DT.F16_5HD, DT.F16_5HD) \
|
||||
.dtype_format(DT.F32_5HD, DT.F32_5HD) \
|
||||
.dtype_format(DT.I32_5HD, DT.I32_5HD) \
|
||||
.get_op_info()
|
||||
|
||||
|
||||
@op_info_register(op_info)
|
||||
def _sqrt_akg():
|
||||
"""Sqrt Akg register"""
|
||||
return
|
@ -0,0 +1,42 @@
|
||||
# Copyright 2020 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.
|
||||
# ============================================================================
|
||||
|
||||
"""Sub op"""
|
||||
from mindspore.ops.op_info_register import op_info_register, AkgAscendRegOp, DataType as DT
|
||||
|
||||
op_info = AkgAscendRegOp("Sub") \
|
||||
.fusion_type("ELEMWISE") \
|
||||
.input(0, "x") \
|
||||
.input(1, "y") \
|
||||
.output(0, "output") \
|
||||
.dtype_format(DT.F16_Default, DT.F16_Default, DT.F16_Default) \
|
||||
.dtype_format(DT.F32_Default, DT.F32_Default, DT.F32_Default) \
|
||||
.dtype_format(DT.I32_Default, DT.I32_Default, DT.I32_Default) \
|
||||
.dtype_format(DT.F16_5HD, DT.F16_5HD, DT.F16_5HD) \
|
||||
.dtype_format(DT.F32_5HD, DT.F32_5HD, DT.F32_5HD) \
|
||||
.dtype_format(DT.I32_5HD, DT.I32_5HD, DT.I32_5HD) \
|
||||
.dtype_format(DT.F16_FracZ, DT.F16_FracZ, DT.F16_FracZ) \
|
||||
.dtype_format(DT.F32_FracZ, DT.F32_FracZ, DT.F32_FracZ) \
|
||||
.dtype_format(DT.I32_FracZ, DT.I32_FracZ, DT.I32_FracZ) \
|
||||
.dtype_format(DT.F16_FracNZ, DT.F16_FracNZ, DT.F16_FracNZ) \
|
||||
.dtype_format(DT.F32_FracNZ, DT.F32_FracNZ, DT.F32_FracNZ) \
|
||||
.dtype_format(DT.I32_FracNZ, DT.I32_FracNZ, DT.I32_FracNZ) \
|
||||
.get_op_info()
|
||||
|
||||
|
||||
@op_info_register(op_info)
|
||||
def _sub_akg():
|
||||
"""Sub Akg register"""
|
||||
return
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue