Automatic tuning of convolutional neural networks on x86 CPUs
发布时间
阅读量:
阅读量
x86 cpu卷积网络的自动调谐
这是一份关于如何针对x86cpu对卷积神经网络进行优化调整的文档。
本内容无法在Windows操作系统或当前最新版的macOS系统中直接执行。若需使其正常运行,应将主程序部分封装于
if name == “main ”: 的代码块中。
import os
import numpy as np
import tvm
from tvm import relay, autotvm
from tvm.relay import testing
from tvm.autotvm.tuner import XGBTuner, GATuner, RandomTuner, GridSearchTuner
from tvm.autotvm.graph_tuner import DPTuner, PBQPTuner
import tvm.contrib.graph_runtime as runtime
定义网络结构
首先需要通过中继前端API来构建网络模型。可以从relay.testing模块中的测试用例或编译后的模型进行加载,例如通过relay.testing.resnet模块实现。此外,也可以从MXNet、ONNX以及TensorFlow等框架导入相关模型。本文以restuning作为示例进行说明。
全部评论 (0)
还没有任何评论哟~
