admin管理员组文章数量:1794759
Consider using a constant container instead (e.g. for `list`, use a `tuple` instead. for `dict`, us
使用torch.jit.trace导出模型时出现:
RuntimeError: Encountering a dict at the output of the tracer might cause the trace to be incorrect, this is only valid if the container structure does not change based on the module's inputs. Consider using a constant container instead (e.g. for `list`, use a `tuple` instead. for `dict`, use a `NamedTuple` instead). If you absolutely need this and know the side effects, pass strict=False to trace() to allow this behavior
按照提示的意思进行修改:
before:
script_module = torch.jit.trace(model,x)修改后:
script_module = torch.jit.trace(model,x,strict=False)究其原因是因为输出结果中出现了list或者dic
本文标签: containerconstantlistdicttuple
版权声明:本文标题:Consider using a constant container instead (e.g. for `list`, use a `tuple` instead. for `dict`, us 内容由林淑君副主任自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.xiehuijuan.com/baike/1686550217a80778.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论