mbaret commented on a change in pull request #8795: URL: https://github.com/apache/tvm/pull/8795#discussion_r700173929
########## File path: python/tvm/relay/backend/contrib/ethosu/te/convolution.py ########## @@ -0,0 +1,199 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# pylint: disable=invalid-name,unused-argument +"""Tensor Expressions for convolutions for the NPU""" +from tvm import te +from .dma import dma_ofm_compute, dma_ifm_compute + + +def process_stride(stride): + """Process the striding into a common format. + + Parameters + ---------- + stride : Union[int, tuple, list] + The 2D striding. + int -> striding is the same in the height and width axis. + 2D -> striding specified as (stride height, stride width). + + Returns + ------- + int + The stride in the height axis. + int + The stride in the width axis. + + """ + assert isinstance(stride, int) or len(stride) == 2 + if isinstance(stride, int): + return stride, stride + + return stride + + +def process_dilation(dilation): + """Process the dilation into a common format. + + Parameters + ---------- + dilation : Union[int, tuple, list] + The 2D dilation. + int -> dilation is the same in the height and width axis. + 2D -> dilation specified as (dilation height, dilation width). + + Returns + ------- + int + The dilation in the height axis. + int + The dilation in the width axis. + + """ + assert isinstance(dilation, int) or len(dilation) == 2 + if isinstance(dilation, int): + return dilation, dilation + + return dilation Review comment: You're right, let's get rid of them. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
