I’ve created a model with a forward function like this:
class Net(nn.Module):
...
  def forward(self, num_nodes, num_feats, nodes):
          features = nn.Embedding(num_nodes, num_feats)
          features.weight = nn.Parameter(torch.FloatTensor(feat_data), requires_grad=False)

then save that model using
traced_script_module = torch.jit.script(net)
traced_script_module.save(model_path1)

I have train model successfully, but get this error when save the model.
NotSupportedError: Compiled functions can't take variable number of arguments or use keyword-only arguments with defaults:...
'Embedding' is being compiled since it was called from '__torch__.___torch_mangle_0.Net.forward'
at <ipython-input-5-501dbaacc7a5>:42:8
    def forward(self, num_nodes, num_feats, nodes):
        
        features = nn.Embedding(num_nodes, num_feats)
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
        features.weight = nn.Parameter(torch.FloatTensor(feat_data), requires_grad=False)


And pytorch’s version is 1.3
What is the best way to handle this?
Any help appreciated!!!