Exemplo n.º 1
0
#
# 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.
"""SqueezeGrad op"""
from mindspore.ops.op_info_register import op_info_register, AkgRegOp, DataType

squeeze_grad_op_info = AkgRegOp("SqueezeGrad") \
    .fusion_type("OPAQUE") \
    .input(0, "y_grad") \
    .output(0, "output") \
    .attr("x_shape", "required", "listInt") \
    .attr("axis", "optional", "listInt") \
    .dtype_format(DataType.F16_Default, DataType.F16_Default) \
    .dtype_format(DataType.F32_Default, DataType.F32_Default) \
    .get_op_info()


@op_info_register(squeeze_grad_op_info)
def _squeeze_grad_akg():
    """SqueezeGrad AutoDiff register"""
    return
Exemplo n.º 2
0
# 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.

"""LessEqual op"""
from mindspore.ops.op_info_register import op_info_register, AkgRegOp, DataType

lessequal_op_info = AkgRegOp("LessEqual") \
    .fusion_type("OPAQUE") \
    .input(0, "x") \
    .input(1, "y") \
    .output(0, "output") \
    .dtype_format(DataType.F16_Default, DataType.F16_Default, DataType.BOOL_Default) \
    .dtype_format(DataType.F32_Default, DataType.F32_Default, DataType.BOOL_Default) \
    .dtype_format(DataType.I32_Default, DataType.I32_Default, DataType.BOOL_Default) \
    .get_op_info()


@op_info_register(lessequal_op_info)
def _lessequal_akg():
    """LessEqual register"""
    return
Exemplo n.º 3
0
# Copyright 2019 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.
"""SimpleMean op"""
from mindspore.ops.op_info_register import op_info_register, AkgRegOp, DataType

mean_op_info = AkgRegOp("SimpleMean") \
    .fusion_type("OPAQUE") \
    .input(0, "x") \
    .output(0, "output") \
    .dtype_format(DataType.F16_Default, DataType.F16_Default) \
    .dtype_format(DataType.F32_Default, DataType.F32_Default) \
    .get_op_info()


@op_info_register(mean_op_info)
def _simple_mean_akg():
    """SimpleMean AutoDiff register"""
    return
Exemplo n.º 4
0
# 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.
"""HSigmoid op"""
from mindspore.ops.op_info_register import op_info_register, AkgRegOp, DataType

hsigmoid_op_info = AkgRegOp("HSigmoid") \
    .fusion_type("OPAQUE") \
    .input(0, "x") \
    .output(0, "output") \
    .dtype_format(DataType.F32_Default, DataType.F32_Default) \
    .dtype_format(DataType.F16_Default, DataType.F16_Default) \
    .get_op_info()


@op_info_register(hsigmoid_op_info)
def _hsigmoid_akg():
    """HSigmoid AutoDiff register"""
    return
Exemplo n.º 5
0
# Copyright 2019 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, AkgRegOp, DataType

cast_op_info = AkgRegOp("Cast") \
    .fusion_type("OPAQUE") \
    .input(0, "x") \
    .output(0, "output") \
    .attr("dst_type", "required", "str") \
    .dtype_format(DataType.F16_Default, DataType.F32_Default) \
    .dtype_format(DataType.F32_Default, DataType.F16_Default) \
    .get_op_info()


@op_info_register(cast_op_info)
def _cast_akg():
    """Cast AutoDiff register"""
    return
Exemplo n.º 6
0
# Copyright 2019 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.
"""ReLU6Grad op"""
from mindspore.ops.op_info_register import op_info_register, AkgRegOp, DataType

relu_grad_op_info = AkgRegOp("ReLU6Grad") \
    .fusion_type("OPAQUE") \
    .input(0, "y_grad") \
    .input(1, "x") \
    .output(0, "output") \
    .dtype_format(DataType.F16_Default, DataType.F16_Default, DataType.F16_Default) \
    .dtype_format(DataType.F32_Default, DataType.F32_Default, DataType.F32_Default) \
    .get_op_info()


@op_info_register(relu_grad_op_info)
def _relu6_grad_akg():
    """ReLU6Grad AutoDiff register"""
    return
Exemplo n.º 7
0
# Copyright 2019 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.
"""Squeeze op"""
from mindspore.ops.op_info_register import op_info_register, AkgRegOp, DataType

squeeze_op_info = AkgRegOp("Squeeze") \
    .fusion_type("OPAQUE") \
    .input(0, "x") \
    .output(0, "output") \
    .attr("axis", "optional", "listInt") \
    .dtype_format(DataType.F16_Default, DataType.F16_Default) \
    .dtype_format(DataType.F32_Default, DataType.F32_Default) \
    .get_op_info()


@op_info_register(squeeze_op_info)
def _squeeze_akg():
    """Squeeze AutoDiff register"""
    return
Exemplo n.º 8
0
# 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.
"""LogicalAnd op"""
from mindspore.ops.op_info_register import op_info_register, AkgRegOp, DataType

logicaland_op_info = AkgRegOp("LogicalAnd") \
    .fusion_type("OPAQUE") \
    .input(0, "x") \
    .input(1, "y") \
    .output(0, "output") \
    .dtype_format(DataType.BOOL_Default, DataType.BOOL_Default, DataType.BOOL_Default) \
    .get_op_info()


@op_info_register(logicaland_op_info)
def _logical_and_akg():
    """LogicalAnd register"""
    return
Exemplo n.º 9
0
#
# 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.

"""SimpleMeanGrad op"""
from mindspore.ops.op_info_register import op_info_register, AkgRegOp, DataType

mean_grad_op_info = AkgRegOp("SimpleMeanGrad") \
    .fusion_type("OPAQUE") \
    .input(0, "HEAD") \
    .output(0, "output") \
    .attr("input_shape", "required", "listInt") \
    .dtype_format(DataType.F16_Default, DataType.F16_Default) \
    .dtype_format(DataType.F32_Default, DataType.F32_Default) \
    .get_op_info()


@op_info_register(mean_grad_op_info)
def _simple_mean_grad_akg():
    """SimpleMeanGrad AutoDiff register"""
    return
Exemplo n.º 10
0
# Copyright 2019 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, AkgRegOp, DataType

mul_op_info = AkgRegOp("Mul") \
    .fusion_type("OPAQUE") \
    .input(0, "x") \
    .input(1, "y") \
    .output(0, "output") \
    .dtype_format(DataType.F16_Default, DataType.F16_Default, DataType.F16_Default) \
    .dtype_format(DataType.F32_Default, DataType.F32_Default, DataType.F32_Default) \
    .get_op_info()


@op_info_register(mul_op_info)
def _mul_akg():
    """Mul AutoDiff register"""
    return
Exemplo n.º 11
0
# Copyright 2019 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.
"""Tile op"""
from mindspore.ops.op_info_register import op_info_register, AkgRegOp, DataType

tile_op_info = AkgRegOp("Tile") \
    .fusion_type("OPAQUE") \
    .input(0, "x") \
    .output(0, "output") \
    .attr("multiples", "required", "listInt") \
    .dtype_format(DataType.F16_Default, DataType.F16_Default) \
    .dtype_format(DataType.F32_Default, DataType.F32_Default) \
    .get_op_info()


@op_info_register(tile_op_info)
def _tile_akg():
    """Tile AutoDiff register"""
    return