Hi,
I am trying to convert a torch model to torchscript. I have removed all non supported operations from my model (the ones raised by torch.jit.script(model) ) but now the conversion fails with the following error:
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-13-d068ba517b85> in <module>
      1 import torch
----> 2 torchscript_model = torch.jit.script(fa)

~/.conda/envs/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py in script(obj, optimize, _frames_up, _rcb)
   1201 
   1202     if isinstance(obj, torch.nn.Module):
-> 1203         return torch.jit.torch.jit._recursive.recursive_script(obj)
   1204 
   1205     qualified_name = _qualified_name(obj)

~/.conda/envs/pytorch/lib/python3.6/site-packages/torch/jit/_recursive.py in recursive_script(mod, exclude_methods)
    171     filtered_methods = filter(ignore_overloaded, methods)
    172     stubs = list(map(make_stub, filtered_methods))
--> 173     return copy_to_script_module(mod, overload_stubs + stubs)
    174 
    175 

~/.conda/envs/pytorch/lib/python3.6/site-packages/torch/jit/_recursive.py in copy_to_script_module(original, stubs)
     93             setattr(script_module, name, item)
     94 
---> 95     torch.jit._create_methods_from_stubs(script_module, stubs)
     96 
     97     # Now that methods have been compiled, take methods that have been compiled

~/.conda/envs/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py in _create_methods_from_stubs(self, stubs)
   1421     rcbs = [m.resolution_callback for m in stubs]
   1422     defaults = [get_default_args(m.original_method) for m in stubs]
-> 1423     self._c._create_methods(self, defs, rcbs, defaults)
   1424 
   1425 # For each user-defined class that subclasses ScriptModule this meta-class,

~/.conda/envs/pytorch/lib/python3.6/site-packages/torch/jit/_recursive.py in create_method_from_fn(module, fn)
    183         # We don't want to call the hooks here since the graph that is calling
    184         # this function is not yet complete
--> 185         torch.jit._create_methods_from_stubs(module, (stub,))
    186     return stub
    187 

~/.conda/envs/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py in _create_methods_from_stubs(self, stubs)
   1421     rcbs = [m.resolution_callback for m in stubs]
   1422     defaults = [get_default_args(m.original_method) for m in stubs]
-> 1423     self._c._create_methods(self, defs, rcbs, defaults)
   1424 
   1425 # For each user-defined class that subclasses ScriptModule this meta-class,

~/.conda/envs/pytorch/lib/python3.6/site-packages/torch/jit/_recursive.py in make_strong_submodule(field, module, parent)
    193 
    194     # Convert the module to a ScriptModule
--> 195     new_strong_submodule = recursive_script(module)
    196 
    197     # Install the ScriptModule on the python side

~/.conda/envs/pytorch/lib/python3.6/site-packages/torch/jit/_recursive.py in recursive_script(mod, exclude_methods)
    171     filtered_methods = filter(ignore_overloaded, methods)
    172     stubs = list(map(make_stub, filtered_methods))
--> 173     return copy_to_script_module(mod, overload_stubs + stubs)
    174 
    175 

~/.conda/envs/pytorch/lib/python3.6/site-packages/torch/jit/_recursive.py in copy_to_script_module(original, stubs)
     93             setattr(script_module, name, item)
     94 
---> 95     torch.jit._create_methods_from_stubs(script_module, stubs)
     96 
     97     # Now that methods have been compiled, take methods that have been compiled

~/.conda/envs/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py in _create_methods_from_stubs(self, stubs)
   1421     rcbs = [m.resolution_callback for m in stubs]
   1422     defaults = [get_default_args(m.original_method) for m in stubs]
-> 1423     self._c._create_methods(self, defs, rcbs, defaults)
   1424 
   1425 # For each user-defined class that subclasses ScriptModule this meta-class,

~/.conda/envs/pytorch/lib/python3.6/site-packages/torch/jit/_recursive.py in create_method_from_fn(module, fn)
    183         # We don't want to call the hooks here since the graph that is calling
    184         # this function is not yet complete
--> 185         torch.jit._create_methods_from_stubs(module, (stub,))
    186     return stub
    187 

~/.conda/envs/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py in _create_methods_from_stubs(self, stubs)
   1421     rcbs = [m.resolution_callback for m in stubs]
   1422     defaults = [get_default_args(m.original_method) for m in stubs]
-> 1423     self._c._create_methods(self, defs, rcbs, defaults)
   1424 
   1425 # For each user-defined class that subclasses ScriptModule this meta-class,

~/.conda/envs/pytorch/lib/python3.6/site-packages/torch/jit/_recursive.py in create_method_from_fn(module, fn)
    183         # We don't want to call the hooks here since the graph that is calling
    184         # this function is not yet complete
--> 185         torch.jit._create_methods_from_stubs(module, (stub,))
    186     return stub
    187 

~/.conda/envs/pytorch/lib/python3.6/site-packages/torch/jit/__init__.py in _create_methods_from_stubs(self, stubs)
   1421     rcbs = [m.resolution_callback for m in stubs]
   1422     defaults = [get_default_args(m.original_method) for m in stubs]
-> 1423     self._c._create_methods(self, defs, rcbs, defaults)
   1424 
   1425 # For each user-defined class that subclasses ScriptModule this meta-class,

RuntimeError: bad optional access

I have no idea how to investigate or solve this problem. Is there any way to get to the root of the issue?
Thanks,
Julien