Skip to content

Commit

Permalink
[TARGET] ONNX codegen (#5052)
Browse files Browse the repository at this point in the history
* Relay to ONNX converter

* Relay to ONNX op test cases

* Relay to ONNX end to end model test cases

* Add test cases to jenkins

* CI CD fixes

* ONNX codegen

* ONNX codegen

* ONNX codegen

* onnx testcases

* ONNX codegen

* test onnx

* ONNX codegen

* shape calculation

* move onnx codegen to contrib/target

* review comments

* ONNX target use visitor

* onnx fixes

* lint fixes

* doc string changes

* review comments

* review comment fixes

* review comment

* pytest skip

* rename type to node type

* test

* Fix for constantshpae, add exp, fix for metadatamodule

* Fix cpplint

* change error tol values
  • Loading branch information
maheshambule authored Jul 15, 2020
1 parent c424da5 commit 5c73efe
Show file tree
Hide file tree
Showing 8 changed files with 1,644 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ tvm_option(USE_CPP_RPC "Build CPP RPC" OFF)
tvm_option(USE_TFLITE "Build with tflite support" OFF)
tvm_option(USE_TENSORFLOW_PATH "TensorFlow root path when use TFLite" none)
tvm_option(USE_COREML "Build with coreml support" OFF)
tvm_option(USE_TARGET_ONNX "Build with ONNX Codegen support" OFF)

if(USE_CPP_RPC AND UNIX)
message(FATAL_ERROR "USE_CPP_RPC is only supported with WIN32. Use the Makefile for non-Windows.")
Expand Down Expand Up @@ -329,6 +330,7 @@ include(cmake/modules/contrib/HybridDump.cmake)
include(cmake/modules/contrib/TFLite.cmake)
include(cmake/modules/contrib/TF_TVMDSOOP.cmake)
include(cmake/modules/contrib/CoreML.cmake)
include(cmake/modules/contrib/ONNX.cmake)

include(CheckCXXCompilerFlag)
if(NOT MSVC)
Expand Down
4 changes: 4 additions & 0 deletions cmake/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,9 @@ set(USE_FALLBACK_STL_MAP OFF)
set(USE_HEXAGON_DEVICE OFF)
set(USE_HEXAGON_SDK /path/to/sdk)

# Whether to use ONNX codegen
set(USE_TARGET_ONNX OFF)

# Whether to compile the standalone C runtime.
set(USE_STANDALONE_CRT ON)

22 changes: 22 additions & 0 deletions cmake/modules/contrib/ONNX.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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.

if(USE_TARGET_ONNX)
message(STATUS "Build with contrib.codegen_onnx")
file(GLOB ONNX_CONTRIB_SRC src/runtime/contrib/onnx/onnx_module.cc)
list(APPEND RUNTIME_SRCS ${ONNX_CONTRIB_SRC})
endif(USE_TARGET_ONNX)
2 changes: 0 additions & 2 deletions python/tvm/contrib/target/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""Codegen and runtime APIs for targets.
"""
Loading

0 comments on commit 5c73efe

Please sign in to comment.