Skip to content

ZeyuChen/tvm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6,204 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open Deep Learning Compiler Stack

Documentation | Contributors | Community | Release Notes

Build Status WinMacBuild

Apache TVM is a compiler stack for deep learning systems. It is designed to close the gap between the productivity-focused deep learning frameworks, and the performance- and efficiency-focused hardware backends. TVM works with deep learning frameworks to provide end to end compilation to different backends.

License

© Contributors Licensed under an Apache-2.0 license.

如何使用TVM编译PaddlePaddle模型

import paddle
paddle.enable_static()
from tvm import relay
import tvm
import numpy as np

# 加载Paddle模型
place = paddle.CPUPlace()
exe = paddle.static.Executor(place)
[prog, feeds, outs] = paddle.static.load_inference_model('model/inference', exe)

# 将Paddle模型转为TVM Relay IR(Function and Parameters)
mod, params = relay.frontend.from_paddle(prog)

with tvm.transform.PassContext(opt_level=1):
    intrp = relay.build_module.create_executor("graph", mod, tvm.cpu(0), 'llvm')

# 进行推理
input_data = np.random.rand(1, 3, 224, 224).astype('float32')
tvm_outputs = itrp.evaluate()(tvm.nd.array(input_data), **params).asnumpy()

About

Open deep learning compiler stack for cpu, gpu and specialized accelerators

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Python 53.6%
  • C++ 39.6%
  • Rust 1.6%
  • C 1.2%
  • Java 0.8%
  • Shell 0.8%
  • Other 2.4%