Hi! Maybe this isn’t the right place for this question. I am trying to write a PyBind11 Torch extension that takes a ScriptModule as input. I have some function like this:
torch::jit::script::Module preprocess(const torch::jit::script::Module& mod) {
  torch::jit::script::Module new_mod(mod._ivalue()->name() + "_txp");
  return new_mod;
}

void add_submodule(pybind11::module_& m) {
  m.def("preprocess",
        &preprocess,
        "Preprocesses the TorchScript module",
        "model"_a);
}

This compiles fine, but when I call the function from Python I get this error:
TypeError: func_name(): incompatible function arguments. The following argument types are supported:
    1. (model: torch::jit::Module) -> torch::jit::Module

Invoked with: <torch._C.ScriptModule object at 0x7fc27d657770>

How do I resolve this?