From commits-return-10144-archive-asf-public=cust-asf.ponee.io@tvm.apache.org Wed Apr 1 17:28:17 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 A049518067F for ; Wed, 1 Apr 2020 19:28:16 +0200 (CEST) Received: (qmail 88955 invoked by uid 500); 1 Apr 2020 17:28:16 -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 88907 invoked by uid 99); 1 Apr 2020 17:28:16 -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; Wed, 01 Apr 2020 17:28:16 +0000 From: GitBox To: commits@tvm.apache.org Subject: [GitHub] [incubator-tvm] zhiics commented on a change in pull request #4459: [RUNTIME] Implement TVMDSOOp(TensorFlow custom op) for TVM runtime Message-ID: <158576209596.4315.575156437181381892.gitbox@gitbox.apache.org> References: In-Reply-To: Date: Wed, 01 Apr 2020 17:28:15 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit zhiics commented on a change in pull request #4459: [RUNTIME] Implement TVMDSOOp(TensorFlow custom op) for TVM runtime URL: https://github.com/apache/incubator-tvm/pull/4459#discussion_r401780846 ########## File path: src/contrib/tf_op/tvm_dso_op_kernels.cc ########## @@ -0,0 +1,344 @@ +/* + * 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. + */ + +#ifdef TF_TVMDSOOP_ENABLE_GPU +#include +#endif +#include + +#include +#include +#include +#include + +#include "tensorflow/core/framework/op_kernel.h" +#include "index_seq.h" + + +typedef Eigen::ThreadPoolDevice CPUDevice; +typedef Eigen::GpuDevice GPUDevice; +typedef tensorflow::gtl::InlinedVector ShapeContainer; + +using tensorflow::OpKernel; +using tensorflow::OpKernelConstruction; +using tensorflow::OpKernelContext; + + +// Op utility trait for diffrent device type template +template +class TVMDSOOpTrait; + + +// Buffer information used for actual computation. +// Each buffer is associated with one TensorFlow tensor +// whose underlying buffer is record into "origin_buf". +// For input tensor, we copy data from origin_buf to buf +// and for output tensor, copy data from buf to origin_buf +class TensorAsBuf { + public: + tensorflow::Tensor inline_tensor; + tensorflow::Tensor* tensor; + Review comment: please use clang-format to fix the indentation for all c++ code ---------------------------------------------------------------- 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