在保证train为true时导出ONNX模型
pytorch吧
全部回复
仅看楼主
level 2
模型是DeblurGan_v2。在模型推理的时候需要保持train为true(图一)。如果我要导出为ONNX,应该怎么做? 图二是我导出模型的代码,结果表明效果不好,和train为false的结果一样。
2023年04月12日 07点04分 1
level 11
设置这个参数
training (enum, default TrainingMode.EVAL) –
TrainingMode.EVAL: export the model in inference mode.
TrainingMode.PRESERVE: export the model in inference mode if model.training is
False and in training mode if model.training is True.
TrainingMode.TRAINING: export the model in training mode. Disables optimizations
which might interfere with training.
详细信息看文档,这里我随便粘贴了一下
2023年04月12日 10点04分 0
level 1
楼主导出成功了吗?
2023年06月30日 08点06分 3
成功了的,就像吧主说的,有一个参数可以控制。
2023年07月01日 07点07分
1