From a2626b8402ec65b79aae9ac38c331e368c9b8fc5 Mon Sep 17 00:00:00 2001 From: Tianqi Chen Date: Wed, 4 Jul 2018 09:04:03 -0700 Subject: [PATCH] [TOPI] Update parameter name of conv2d (#1380) --- nnvm/python/nnvm/testing/darknet.py | 2 +- topi/python/topi/nn/conv2d.py | 13 +++++++------ topi/python/topi/rasp/conv2d.py | 5 +---- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/nnvm/python/nnvm/testing/darknet.py b/nnvm/python/nnvm/testing/darknet.py index ed8bf021c462..f6bbf8f7d951 100644 --- a/nnvm/python/nnvm/testing/darknet.py +++ b/nnvm/python/nnvm/testing/darknet.py @@ -9,8 +9,8 @@ from __future__ import division import math import numpy as np -import cv2 from cffi import FFI +import cv2 def _resize_image(img, w_in, h_in): """Resize the image to the given height and width.""" diff --git a/topi/python/topi/nn/conv2d.py b/topi/python/topi/nn/conv2d.py index 734ccb3bf2d6..43912368cf05 100644 --- a/topi/python/topi/nn/conv2d.py +++ b/topi/python/topi/nn/conv2d.py @@ -1,4 +1,5 @@ -# pylint: disable=invalid-name, unused-variable, too-many-locals, unused-argument +# pylint: disable=invalid-name, unused-variable, too-many-locals +# pylint: disable=unused-argument, redefined-builtin """Conv2D operators""" from __future__ import absolute_import as _abs from collections import namedtuple @@ -75,7 +76,7 @@ _CONV_SCHEDULE = {} @tvm.target.generic_func -def conv2d(data, kernel, stride, padding, layout='NCHW', out_dtype=None): +def conv2d(input, filter, strides, padding, layout='NCHW', out_dtype=None): """Conv2D operator. Parameters @@ -86,7 +87,7 @@ def conv2d(data, kernel, stride, padding, layout='NCHW', out_dtype=None): filter : tvm.Tensor 4-D with shape [num_filter, in_channel, filter_height, filter_width] - stride : int or a list/tuple of two ints + strides : int or a list/tuple of two ints stride size, or [stride_height, stride_width] padding : int or a list/tuple of two ints @@ -103,11 +104,11 @@ def conv2d(data, kernel, stride, padding, layout='NCHW', out_dtype=None): # search platform specific declaration first # default declaration if layout == 'NCHW': - return conv2d_nchw(data, kernel, stride, padding, out_dtype) + return conv2d_nchw(input, filter, strides, padding, out_dtype) elif layout == 'HWCN': - return conv2d_hwcn(data, kernel, stride, padding, out_dtype) + return conv2d_hwcn(input, filter, strides, padding, out_dtype) elif layout == 'NHWC': - return conv2d_nhwc(data, kernel, stride, padding, out_dtype) + return conv2d_nhwc(input, filter, strides, padding, out_dtype) else: raise ValueError("not support this layout {} yet".format(layout)) diff --git a/topi/python/topi/rasp/conv2d.py b/topi/python/topi/rasp/conv2d.py index 13af1b93705e..b958d00f2913 100644 --- a/topi/python/topi/rasp/conv2d.py +++ b/topi/python/topi/rasp/conv2d.py @@ -2,7 +2,6 @@ """Conv2D schedule on raspberry pi""" from __future__ import absolute_import as _abs import tvm -from tvm import target as _target from .. import tag from ..nn.conv2d import conv2d as _conv2d, _get_schedule from ..nn.conv2d import SpatialPack, Im2ColPack @@ -201,9 +200,7 @@ def _schedule_im2col_conv2d(s, data, data_pad, data_col, data_vec, else: stride = infer_stride(data_pad, kernel, output) wkl = _get_workload(data, kernel, stride, padding, output.dtype) - - with _target.rasp(): - sch = _get_schedule(wkl) + sch = _get_schedule(wkl) H, W = wkl.height, wkl.width CI = wkl.in_filter