How to script a model using c++ extension? I met this error

How to script a model using c++ extension? I met this error

Could not export Python function call '_DCNv2'. Remove calls to Python functions before export. Did you forget add @script or @script_method annotation? If this is a nn.ModuleList

Can u show the part of code that produced this error?

I try to use “torch.jit.trace” to script EDVR( model as follows:

import models.modules.EDVR_arch as EDVR_arch
device = torch.device('cuda')

model_path = '../experiments/pretrained_models/train_perceptual_loss_420600_G.pth'
N_in = 5
predeblur, HR_in = True, True
model = EDVR_arch.EDVR(64, N_in, 8, 5, 10, predeblur=predeblur, HR_in=HR_in, w_TSA=False) 
model.load_state_dict(torch.load(model_path), strict=True)
model =
example = torch.rand((1, 5, 3, 512, 512), device='cuda:0')
torch_script_model = torch.jit.trace(model, example)'')

EDVR use c++ extension to implement deformable convolutional networks

I think trace is having trouble with the c++ extensions. To make jit.trace work with C++ extension, those C++ operations should be registered to jit. See this link for more information.

Thand you! I will try, and then feedback here.

I face the same problem. any update on this?