Fail to export the model in PyTorch

https://github.com/onnx/tutorials/blob/master/tutorials/PytorchAddExportSupport.md#fail-to-export-the-model-in-pytorch

1. RuntimeError: ONNX export failed: Couldn't export operator aten::rsqrt

2. RuntimeError: ONNX export failed: Couldn't export operator aten::reshape

原因:pytorch-1.0.1不支持reshape操作

解决:~/anaconda3/envs/py36/lib/python3.6/site-packages/torch/onnx/symbolic.py

在该文件中添加代码

def reshape(g, self, shape):
return view(g, self, shape) def reshape_as(g, self, other):
shape = g.op('Shape', other)
return reshape(g, self, shape)

3. ONNX export failed on ATen operator group_norm because torch.onnx.symbolic.group_norm does not exist

解决:~/anaconda3/envs/py36/lib/python3.6/site-packages/torch/onnx/symbolic.py

@parse_args('v', 'i', 'v', 'v', 'f', 'i')
def group_norm(g, input, num_groups, weight, bias, eps, cudnn_enabled):
return g.op("ATen", input, weight, bias, num_groups_i=num_groups,
eps_f=eps, cudnn_enabled_i=cudnn_enabled, operator_s="group_norm")

pytorch转onnx问题的更多相关文章

  1. 从PyTorch到ONNX的端到端AlexNet

    从PyTorch到ONNX的端到端AlexNet 这是一个简单的脚本,可将Torchvision中定义的经过预训练的AlexNet导出到ONNX中.运行一轮推理Inference,然后将生成的跟踪模型 ...

  2. 生产与学术之Pytorch模型导出为安卓Apk尝试记录

    生产与学术 写于 2019-01-08 的旧文, 当时是针对一个比赛的探索. 觉得可能对其他人有用, 就放出来分享一下 生产与学术, 真实的对立... 这是我这两天对pytorch深度学习->a ...

  3. pytorch模型结构可视化,可显示每层的尺寸

    最近在学习一些检测方面的网络,使用的是pytorch.模型结构可视化是学习网络的有用的部分,pytorch没有原生支持这个功能,需要找一些其他方式,下面总结几种方法(推荐用4). 1. torch . ...

  4. F#周报2019年第6期

    新闻 应用F#挑战活动 Visual F#:锁定VS 2019正式版本 Visual F#:VS 2019工具性能 ML.NET 0.10发布 F# eXchange 2019即将来临 Visual ...

  5. 让你的AI模型尽可能的靠近数据源

    来源:Redislabs作者:Pieter Cailliau.LucaAntiga翻译:Kevin (公众号:中间件小哥) 简介 今天我们发布了一个 RedisAI 的预览版本,预集成了[tensor ...

  6. 痞子衡嵌入式:Ethos-U55,ARM首款面向Cortex-M的microNPU

    大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家介绍的是ARM Ethos-U55. ARM 前几天刚发布了 Cortex-M 家族最新一款内核 - Cortex-M55 以及首款面向 Cor ...

  7. MLPerf Inference 0.7应用

    MLPerf Inference 0.7应用 三个趋势继续推动着人工智能推理市场的训练和推理:不断增长的数据集,日益复杂和多样化的网络,以及实时人工智能服务. MLPerf 推断 0 . 7 是行业标 ...

  8. ONNXRuntime学习笔记(三)

    接上一篇完成的pytorch模型训练结果,模型结构为ResNet18+fc,参数量约为11M,最终测试集Acc达到94.83%.接下来有分两个部分:导出onnx和使用onnxruntime推理. 一. ...

  9. 使用TensorRT对caffe和pytorch onnx版本的mnist模型进行fp32和fp16 推理 | tensorrt fp32 fp16 tutorial with caffe pytorch minist model

    本文首发于个人博客https://kezunlin.me/post/bcdfb73c/,欢迎阅读最新内容! tensorrt fp32 fp16 tutorial with caffe pytorch ...

随机推荐

  1. JAVA 基础编程练习题18 【程序 18 乒乓球赛】

    18 [程序 18 乒乓球赛] 题目:两个乒乓球队进行比赛,各出三人.甲队为 a,b,c 三人,乙队为 x,y,z 三人.已抽签决定比赛名单. 有人向队员打听比赛的名单.a 说他不和 x 比,c 说他 ...

  2. Python常用模块安装

    1. python操作MySQL数据库的依赖包MySQLdb ImportError: No module named MySQLdb 安装方式: yum install MySQL-python 2 ...

  3. 比特币区块的hash算法

    Block hashing algorithm Bitcoin mining uses the hashcash proof of work function; the hashcash algori ...

  4. Spring Security(01)——初体验

    (注:本文是基于Spring Security3.1.6所写) (注:原创文章,转载请注明出处.原文地址:http://elim.iteye.com/blog/2154299) (注:本文是基于Spr ...

  5. 集群架构01.Nginx初步安装配置

    1.切换163yum 源,环境介绍 [root@moban ~]# cat /etc/redhat-release CentOS release 6.5 (Final) mv CentOS-Base. ...

  6. Paid consultation (currently free 20190901)

    Master of Electrical Engineering, Chongqing University Range:01 College entrance examination, major, ...

  7. SIFT学习笔记之一 下载和调用

     下面给出了多个参考地址,挑个能用的吧: vs2010+Rob Hess SIFT: http://blog.csdn.net/lanbing510/article/details/8507341 R ...

  8. 【并行计算与CUDA开发】英伟达硬件加速解码器在 FFMPEG 中的使用

    目录(?)[-] 私有驱动 编译 FFMPEG 使用 nvenc 这篇文档介绍如何在 ffmpeg 中使用 nvenc 硬件编码器. 私有驱动 nvenc 本身是依赖于 nvidia 底层的私有驱动的 ...

  9. ORK

    小试OKR一季度之后有感分享,你要不要试试ORK?   封面 OKR已经在国内热火朝天有一阵子了,为了适当的赶时髦,从年初开始团队内部小范围使用ORK模式以便测试团队会有什么化学反应.这篇文章打算写写 ...

  10. dubbo分布式服务框架-study2

    本文开始对springboot+dubbo集成,使用的版本为springboot 2.0.0.dubbo 2.0.0,步骤如下: 1.添加依赖: <dependency> <grou ...