RuntimeError converting mask rcnn to c++

Hi everyone,

I have built mask r cnn code in I can train model, and test well. But when I run code:

“example = torch.rand(1, 3, 559, 536)‘cpu’)
traced_script_module = torch.jit.trace(model, example)”

I got an error:

"File “C:\Users\ncali\anaconda3\envs\pt_37\lib\site-packages\torchvision\models\”, line 218, in decode_single pred_ctr_x = dx * widths[:, None] + ctr_x[:, None]

RuntimeError: expected device cpu but got device cuda:0"

I think it is related with “RuntimeError after moving fasterrcnn_resnet50_fpn to CPU from GPU #1738

I have just added some trace line in

in training phase, it returns :

but after “‘cpu’)”, I have get it:

Here is my new question:
I have tried by training over cpu, and overcome it. But now, I got this error:

“RuntimeError: Only tensors or tuples of tensors can be output from traced functions (getOutput at …\torch\csrc\jit\tracer.cpp:212)
(no backtrace available)” :confused: