forked from mindspore-Ecosystem/mindspore
gpu add akg logialnot sub
This commit is contained in:
parent
f746caf592
commit
1c6a690a2d
|
@ -0,0 +1,40 @@
|
||||||
|
# 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.
|
||||||
|
"""logical_not"""
|
||||||
|
import _akg.tvm
|
||||||
|
from _akg.ops.math import logical_not
|
||||||
|
from _akg.topi.generic import schedule_elemwise
|
||||||
|
|
||||||
|
def LogicalNot(x):
|
||||||
|
"""LogicalNot."""
|
||||||
|
return logical_not.logical_not(x)
|
||||||
|
|
||||||
|
|
||||||
|
def gpu_schedule_LogicalNot(outs):
|
||||||
|
"""
|
||||||
|
GPU schedule for LogicalNot.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
outs (tvm.tensor.Tensor): outputs of compute.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
sch (schedule.Schedule): The created schedule.
|
||||||
|
"""
|
||||||
|
device = 'cuda'
|
||||||
|
ctx = _akg.tvm.context(device, 0)
|
||||||
|
if not ctx.exist:
|
||||||
|
raise SystemError("Skip because %s is not enabled" % device)
|
||||||
|
with _akg.tvm.target.create(device):
|
||||||
|
sch = schedule_elemwise(outs)
|
||||||
|
return sch
|
|
@ -0,0 +1,40 @@
|
||||||
|
# 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"""
|
||||||
|
import _akg.tvm
|
||||||
|
from _akg.ops.math import sub
|
||||||
|
from _akg.topi.generic import schedule_elemwise
|
||||||
|
|
||||||
|
def Sub(x, y):
|
||||||
|
"""Sub."""
|
||||||
|
return sub.sub(x, y)
|
||||||
|
|
||||||
|
|
||||||
|
def gpu_schedule_Sub(outs):
|
||||||
|
"""
|
||||||
|
GPU schedule for Sub.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
outs (tvm.tensor.Tensor): outputs of compute.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
sch (schedule.Schedule): The created schedule.
|
||||||
|
"""
|
||||||
|
device = 'cuda'
|
||||||
|
ctx = _akg.tvm.context(device, 0)
|
||||||
|
if not ctx.exist:
|
||||||
|
raise SystemError("Skip because %s is not enabled" % device)
|
||||||
|
with _akg.tvm.target.create(device):
|
||||||
|
sch = schedule_elemwise(outs)
|
||||||
|
return sch
|
|
@ -0,0 +1,32 @@
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
"""operator dsl function: logical_not"""
|
||||||
|
import _akg.tvm
|
||||||
|
import _akg.topi
|
||||||
|
from _akg.utils import validation_check as vc_util
|
||||||
|
|
||||||
|
@vc_util.check_input_type(_akg.tvm.tensor.Tensor)
|
||||||
|
def logical_not(input1):
|
||||||
|
"""
|
||||||
|
Compute logical_not of input1.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
input1 (tvm.tensor.Tensor): Tensor.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
tvm.tensor.Tensor.
|
||||||
|
"""
|
||||||
|
res = _akg.topi.logical_not(input1)
|
||||||
|
return res
|
|
@ -0,0 +1,28 @@
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
"""LogicalNot op"""
|
||||||
|
from mindspore.ops.op_info_register import op_info_register, AkgRegOp, DataType
|
||||||
|
|
||||||
|
logical_not_op_info = AkgRegOp("LogicalNot") \
|
||||||
|
.fusion_type("OPAQUE") \
|
||||||
|
.input(0, "x") \
|
||||||
|
.output(0, "output") \
|
||||||
|
.dtype_format(DataType.BOOL_Default, DataType.BOOL_Default) \
|
||||||
|
.get_op_info()
|
||||||
|
|
||||||
|
@op_info_register(logical_not_op_info)
|
||||||
|
def _logical_not_akg():
|
||||||
|
"""LogicalNot AutoDiff register"""
|
||||||
|
return
|
|
@ -0,0 +1,31 @@
|
||||||
|
# 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, AkgRegOp, DataType
|
||||||
|
|
||||||
|
sub_op_info = AkgRegOp("Sub") \
|
||||||
|
.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) \
|
||||||
|
.dtype_format(DataType.I32_Default, DataType.I32_Default, DataType.I32_Default) \
|
||||||
|
.get_op_info()
|
||||||
|
|
||||||
|
@op_info_register(sub_op_info)
|
||||||
|
def _sub_akg():
|
||||||
|
"""Sub AutoDiff register"""
|
||||||
|
return
|
Loading…
Reference in New Issue