TVM官网链接
Compile Keras Models
本文是介绍如何使用Relay部署keras模型的入门教程。
首先,应该安装keras。 还需要Tensorflow,因为它被用作keras的默认后端。
一个快速的解决方案是通过pip安装
pip install -U keras --user
pip install -U tensorflow --user
或请参阅官方网站https://keras.io/#installation
import tvm
from tvm import te
import tvm.relay as relay
from tvm.contrib.download import download_testdata
import keras
import numpy as np
加载预训练的Keras模型
我们加载了由keras提供的预训练的resnet-50分类模型。
if tuple(keras.__version__.split(".")) < ("2", "4", "0"):
weights_url = "".join(
[
"https://github.com/fchollet/deep-learning-models/releases/",
"down