From commits-return-11179-archive-asf-public=cust-asf.ponee.io@tvm.apache.org Sun Apr 12 06:07:58 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id A1163180608 for ; Sun, 12 Apr 2020 08:07:58 +0200 (CEST) Received: (qmail 68350 invoked by uid 500); 12 Apr 2020 06:07:58 -0000 Mailing-List: contact commits-help@tvm.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tvm.apache.org Delivered-To: mailing list commits@tvm.apache.org Received: (qmail 68330 invoked by uid 99); 12 Apr 2020 06:07:58 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Apr 2020 06:07:58 +0000 From: GitBox To: commits@tvm.apache.org Subject: [GitHub] [incubator-tvm] icemelon9 commented on a change in pull request #5284: [Topi] Tensorcore support for Conv3D Message-ID: <158667167794.21245.10235495357476293056.gitbox@gitbox.apache.org> References: In-Reply-To: Date: Sun, 12 Apr 2020 06:07:57 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit icemelon9 commented on a change in pull request #5284: [Topi] Tensorcore support for Conv3D URL: https://github.com/apache/incubator-tvm/pull/5284#discussion_r407151248 ########## File path: topi/tests/python/test_topi_conv3d_ndhwc_tensorcore.py ########## @@ -0,0 +1,127 @@ +# 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, too-many-locals, too-many-arguments +"""Example code to do convolution.""" + +import numpy as np +import tvm +import topi +import topi.testing +from tvm import te +from tvm.contrib.pickle_memoize import memoize +from tvm.contrib import nvcc +from topi.nn.util import get_pad_tuple3d +from topi.util import get_const_tuple + + +_conv3d_ndhwc_tensorcore_implement = { + "cuda": (topi.cuda.conv3d_ndhwc_tensorcore, topi.cuda.schedule_conv3d_ndhwc_tensorcore) +} + + +def verify_conv3d_ndhwc(batch, in_channel, in_size, num_filter, kernel, stride, + padding, dilation=1, add_bias=False, add_relu=False, devices='cuda'): + """Test the conv2d with tensorcore for nhwc layout""" + pad_front, pad_top, pad_left, pad_back, pad_bottom, pad_right = get_pad_tuple3d( + padding, (kernel, kernel, kernel)) + padding_sum = pad_front + pad_top + pad_left + pad_back + pad_bottom + pad_right + print("Workload: (%d, %d, %d, %d, %d, %d, %d, %d)" % ( + batch, in_channel, in_size, num_filter, kernel, stride, padding_sum, dilation)) + + in_depth = in_height = in_width = in_size + + A = te.placeholder((batch, in_depth, in_height, in_width, in_channel), name='A') + W = te.placeholder((kernel, kernel, kernel, in_channel, num_filter), name='W') + bias = te.placeholder((1, 1, 1, 1, num_filter), name='bias') + + a_shape = get_const_tuple(A.shape) + w_shape = get_const_tuple(W.shape) + bias_shape = get_const_tuple(bias.shape) + dtype = A.dtype + + @memoize("topi.tests.test_topi_conv2d_nhwc.verify_conv2d_nhwc") Review comment: ```suggestion @memoize("topi.tests.test_topi_conv3d_ndhwc. verify_conv3d_ndhwc") ``` ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services