/usr/local/lib/python3.7/dist-packages/torch/jit/_recursive.py in create_script_module(nn_module, stubs_fn, share_types, is_tracing)
452 if not is_tracing:
453 AttributeTypeIsSupportedChecker().check(nn_module)
--> 454 return create_script_module_impl(nn_module, concrete_type, stubs_fn)
455
456 def create_script_module_impl(nn_module, concrete_type, stubs_fn):
/usr/local/lib/python3.7/dist-packages/torch/jit/_recursive.py in create_script_module_impl(nn_module, concrete_type, stubs_fn)
514
515 # Actually create the ScriptModule, initializing it with the function we just defined
--> 516 script_module = torch.jit.RecursiveScriptModule._construct(cpp_module, init_fn)
517
518 # Compile methods if necessary
/usr/local/lib/python3.7/dist-packages/torch/jit/_script.py in _construct(cpp_module, init_fn)
592 """
593 script_module = RecursiveScriptModule(cpp_module)
--> 594 init_fn(script_module)
595
596 # Finalize the ScriptModule: replace the nn.Module state with our
/usr/local/lib/python3.7/dist-packages/torch/jit/_recursive.py in init_fn(script_module)
492 else:
493 # always reuse the provided stubs_fn to infer the methods to compile
--> 494 scripted = create_script_module_impl(orig_value, sub_concrete_type, stubs_fn)
495
496 cpp_module.setattr(name, scripted)
/usr/local/lib/python3.7/dist-packages/torch/jit/_recursive.py in create_script_module_impl(nn_module, concrete_type, stubs_fn)
518 # Compile methods if necessary
519 if concrete_type not in concrete_type_store.methods_compiled:
--> 520 create_methods_and_properties_from_stubs(concrete_type, method_stubs, property_stubs)
521 # Create hooks after methods to ensure no name collisions between hooks and methods.
522 # If done before, hooks can overshadow methods that aren't exported.
/usr/local/lib/python3.7/dist-packages/torch/jit/_recursive.py in create_methods_and_properties_from_stubs(concrete_type, method_stubs, property_stubs)
369 property_rcbs = [p.resolution_callback for p in property_stubs]
370
--> 371 concrete_type._create_methods_and_properties(property_defs, property_rcbs, method_defs, method_rcbs, method_defaults)
372
373 def create_hooks_from_stubs(concrete_type, hook_stubs, pre_hook_stubs):
RuntimeError: Can't redefine method: forward on class: torch.model.Encoder (of Python compilation unit at: 0x5353200)
Hi, I'm trying to port my trained tacotron2 model to android, for this I've written the following code :
But this gives the following error :