Closed wqn628 closed 1 year ago
model = Net()
src_forward_func = model.forward
model.forward = mode.inference
# convert operate
xxxxxx
# replace previous func
model.forward = src_forward_func
This issue has not received any updates in 120 days. Please reply to this issue if this still unresolved!
这里是我的模型定义:
训练 过程用的是forward 函数,在部署的时候我想用inference 函数推理。因此,我在训练代码中做了如下修改:
然而当执行到convert_deploy(model.eval(), backend, input_shape, output_path=model_dir, model_name=model_name) 这个函数时,错误发生了:
函数convert_deploy的定义如下:
想请教一下各位大佬,如果模型部署推理的时候 调的不是forward 函数而是其他函数的话,应该怎么做呀。 十分感谢,叨扰各位了