2023年11月29日发(作者:)
keras模型转换为onnx模型推理,记录实现过程
1、将keras下的预训练模型加载后,进⾏推理时要⽤t(x,y)的形式,想直接改成model(x,y)。⾃⼰⾸先进⾏了源码改
写,出现错误:
RuntimeError: Detected a call to `t` inside a `on`.
`t is a high-level endpoint that manages its own `on`.
Please move the call to `t` outside of all enclosing `on`s.
sess = nceSession(output_model_path)
res = (None, {'token_ids': token_('float32'), 'segment_ids':segment_('float32')})
print(res[0])


发布评论