# 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. # pylint: disable=invalid-name """Schedule for depthwise_conv2d with auto fusion""" import tvm from tvm import autotvm from ..util import traverse_inline from .. import tag from .. import generic, nn from ..nn.depthwise_conv2d import depthwise_conv2d_infer_layout # register original implementation of depthwise_conv2d_nchw since we don't need to change this part autotvm.register_topi_compute(nn.depthwise_conv2d_nchw, ['intel_graphics'], 'direct', nn.depthwise_conv2d_nchw.fdefault) @autotvm.register_topi_schedule(generic.schedule_depthwise_conv2d_nchw, \ ['intel_graphics'], 'direct') def schedule_depthwise_conv2d_nchw_intel_graphics(cfg, outs): """Schedule for depthwise_conv2d nchw forward. Parameters ---------- outs: Array of Tensor The computation graph description of depthwise_conv2d in the format of an array of tensors. Returns ------- s: Schedule
# "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. # pylint: disable=invalid-name,unused-variable,unused-argument """depthwise_conv2d schedule on ARM Mali GPU""" import tvm from tvm import autotvm from ..generic import schedule_depthwise_conv2d_nchw from ..nn import depthwise_conv2d_nchw from ..util import traverse_inline # register original implementation of depthwise_conv2d_nchw since we don't need to change this part autotvm.register_topi_compute(depthwise_conv2d_nchw, 'mali', 'direct', depthwise_conv2d_nchw.fdefault) # register customized schedule for arm cpu. @autotvm.register_topi_schedule(schedule_depthwise_conv2d_nchw, 'mali', 'direct') def schedule_depthwise_conv2d_nchw_mali(cfg, outs): """Schedule depthwise conv2d Parameters ---------- cfg: ConfigEntity The configuration of this template outs: Array of Tensor The computation graph description of depthwise convolution2d in the format of an array of tensors. Returns
# specific language governing permissions and limitations # under the License. # pylint: disable=invalid-name """The template for cuda group_conv2d_nchw""" import tvm from tvm import autotvm from .injective import _schedule_injective from .tensor_intrin import dp4a from ..nn.pad import pad from ..nn.util import get_pad_tuple from ..util import traverse_inline, get_const_tuple, get_const_int from .. import nn, generic autotvm.register_topi_compute(nn.group_conv2d_nchw, ['cuda', 'gpu'], 'direct', nn.group_conv2d_nchw.fdefault) @autotvm.register_topi_compute(nn.group_conv2d_nchw, ['cuda', 'gpu'], ['int8']) def group_conv2d_nchw_cuda(cfg, data, kernel, stride, padding, dilation, groups, out_dtype='float32'): """Group convolution operator for 'group_conv2d_NCHWc_int8'. Parameters ---------- data : tvm.Tensor 4-D with shape [batch, in_channel, in_height, in_width] or 5-D with shape [batch, in_channel_chunk, in_height, in_width, in_channel_block] kernel : tvm.Tensor 4-D with shape [num_filter, in_channel // groups, filter_height, filter_width] or 6-D with shape [num_filter_chunk, in_channel_chunk // groups, filter_height,
# specific language governing permissions and limitations # under the License. # pylint: disable=invalid-name """The template for cuda group_conv2d_nchw""" import tvm from tvm import autotvm from .injective import _schedule_injective from .tensor_intrin import dp4a from ..nn.pad import pad from ..nn.util import get_pad_tuple from ..util import traverse_inline, get_const_tuple, get_const_int from .. import nn, generic autotvm.register_topi_compute(nn.group_conv2d_nchw, ['cuda', 'gpu'], 'direct', nn.group_conv2d_nchw.fdefault) @autotvm.register_topi_compute(nn.group_conv2d_nchw, ['cuda', 'gpu'], ['int8']) def group_conv2d_nchw_cuda(cfg, data, kernel, stride, padding, dilation, groups, out_dtype='float32'): """Group convolution operator for 'group_conv2d_NCHWc_int8'. Parameters ---------- data : tvm.Tensor 4-D with shape [batch, in_channel, in_height, in_width] or 5-D with shape [batch, in_channel_chunk, in_height, in_width, in_channel_block] kernel : tvm.Tensor 4-D with shape [num_filter, in_channel // groups, filter_height, filter_width] or 6-D with shape [num_filter_chunk, in_channel_chunk // groups, filter_height,
# KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # pylint: disable=invalid-name,unused-variable """Depthwise convolution schedule for ARM CPU""" import tvm from tvm import autotvm from ..generic import schedule_depthwise_conv2d_nchw from ..nn import depthwise_conv2d_nchw, pad from ..util import traverse_inline, get_const_tuple, get_const_int from ..nn.util import get_pad_tuple # register original implementation of depthwise_conv2d_nchw since we don't need to change this part autotvm.register_topi_compute(depthwise_conv2d_nchw, 'arm_cpu', 'direct', depthwise_conv2d_nchw.fdefault) # register customized schedule for arm cpu. @autotvm.register_topi_schedule(schedule_depthwise_conv2d_nchw, 'arm_cpu', ['direct', 'contrib_spatial_pack']) def schedule_depthwise_conv2d_nchw_arm(cfg, outs): """Schedule depthwise conv2d Parameters ---------- cfg: ConfigEntity The configuration of this template outs: Array of Tensor The computation graph description of depthwise convolution2d in the format of an array of tensors.
# # 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. # pylint: disable=invalid-name """Schedule template of deformable conv2d with cuda backend""" import tvm from tvm import autotvm from .. import nn, generic from ..util import traverse_inline autotvm.register_topi_compute(nn.deformable_conv2d_nchw, ["cuda", "gpu"], "direct", nn.deformable_conv2d_nchw.fdefault) @autotvm.register_topi_schedule(generic.schedule_deformable_conv2d_nchw, ["cuda", "gpu"], "direct") def schedule_deformable_conv2d_nchw_cuda(cfg, outs): """TOPI schedule callback of deformable conv2d for cuda gpu Parameters ---------- cfg: ConfigEntity The config for this template outs: Array of Tensor The computation graph description of conv2d in the format of an array of tensors.
# pylint: disable=invalid-name,unused-variable """dense schedule on ARM Mali GPU""" from __future__ import absolute_import as _abs import tvm from tvm import autotvm from .. import generic, nn from ..util import traverse_inline autotvm.register_topi_compute(nn.dense, 'mali', 'direct', nn.dense.fdefault) @autotvm.register_topi_schedule(generic.schedule_dense, 'mali', 'direct') def schedule_dense(cfg, outs): """Schedule for dense operator. Parameters ---------- cfg: ConfigEntity The config entity for this template outs: Array of Tensor The computation graph description of dense in the format of an array of tensors. Returns ------- s: Schedule The computation schedule for dense. """ outs = [outs] if isinstance(outs, tvm.tensor.Tensor) else outs
# pylint: disable=invalid-name,unused-variable """dense schedule on ARM Mali GPU""" from __future__ import absolute_import as _abs import tvm from tvm import autotvm from .. import generic, nn from ..util import traverse_inline autotvm.register_topi_compute(nn.dense, 'mali', 'direct', nn.dense.fdefault) @autotvm.register_topi_schedule(generic.schedule_dense, 'mali', 'direct') def schedule_dense(cfg, outs): """Schedule for dense operator. Parameters ---------- cfg: ConfigEntity The config entity for this template outs: Array of Tensor The computation graph description of dense in the format of an array of tensors. Returns ------- s: Schedule The computation schedule for dense. """
# pylint: disable=invalid-name """Schedule template of deformable conv2d with cuda backend""" import tvm from tvm import autotvm from .. import nn, generic from ..util import traverse_inline autotvm.register_topi_compute(nn.deformable_conv2d_nchw, ["cuda", "gpu"], "direct", nn.deformable_conv2d_nchw.fdefault) @autotvm.register_topi_schedule(generic.schedule_deformable_conv2d_nchw, ["cuda", "gpu"], "direct") def schedule_deformable_conv2d_nchw_cuda(cfg, outs): """TOPI schedule callback of deformable conv2d for cuda gpu Parameters ---------- cfg: ConfigEntity The config for this template outs: Array of Tensor The computation graph description of conv2d in the format of an array of tensors. Returns ------- s: Schedule The computation schedule for conv2d. """ outs = [outs] if isinstance(outs, tvm.tensor.Tensor) else outs
# pylint: disable=invalid-name,unused-variable """Depthwise convolution schedule for ARM CPU""" import tvm from tvm import autotvm from ..generic import schedule_depthwise_conv2d_nchw from ..nn import depthwise_conv2d_nchw from ..util import traverse_inline # register original implementation of depthwise_conv2d_nchw since we don't need to change this part autotvm.register_topi_compute(depthwise_conv2d_nchw, ['arm_cpu', 'cpu'], 'direct', depthwise_conv2d_nchw.fdefault) # register customized schedule for arm cpu. @autotvm.register_topi_schedule(schedule_depthwise_conv2d_nchw, ['arm_cpu', 'cpu'], 'direct') def schedule_depthwise_conv2d_nchw_arm(cfg, outs): """Schedule depthwise conv2d Parameters ---------- cfg: ConfigEntity The configuration of this template outs: Array of Tensor The computation graph description of depthwise convolution2d in the format of an array of tensors. Returns ------- s: Schedule The computation schedule for depthwise_conv2d nchw.