I trained the model for the experiment, I did a test on pytorch well.
but ,The following error occurs when converting and saving through torch.jit.trace.
Full error phrase :
Traceback (most recent call last):
File “D:/Landmark/pytorch/convert2C_merge_model.py”, line 190, in
traced_script_module.save("./model/output.pt")
File “C:\Users\kcw\Anaconda3\envs\pytorch\lib\site-packages\torch\jit_init_.py”, line 1205, in save
return self._c.save(*args, **kwargs)
RuntimeError:
could not export python function call Scatter. Remove calls to Python functions before export. Did you forget add @script or @script_method annotation? If this is a nn.ModuleList, add it to constants.:
C:\Users\kcw\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\parallel\scatter_gather.py(13): scatter_map
C:\Users\kcw\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\parallel\scatter_gather.py(15): scatter_map
C:\Users\kcw\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\parallel\scatter_gather.py(28): scatter
C:\Users\kcw\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\parallel\scatter_gather.py(35): scatter_kwargs
C:\Users\kcw\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\parallel\data_parallel.py(159): scatter
C:\Users\kcw\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\parallel\data_parallel.py(148): forward
C:\Users\kcw\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py(481): _slow_forward
C:\Users\kcw\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py(491): call
D:/Landmark/pytorch/convert2C_merge_model.py(74): forward
C:\Users\kcw\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py(481): slow_forward
C:\Users\kcw\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py(491): call
C:\Users\kcw\Anaconda3\envs\pytorch\lib\site-packages\torch\jit_init.py(688): trace
D:/Landmark/pytorch/convert2C_merge_model.py(187):
help me… plz…