TypeError                                 Traceback (most recent call last)
 in ()
10 # Export the trained model to ONNX
11 dummy_input = Variable(torch.randn(1, 1, 28, 28)) # one black and white 28 x 28 picture will be the input to the model
—> 12 torch.onnx.export(trained_model, dummy_input, “sentiment.onnx”)
9 frames
/usr/local/lib/python3.6/dist-packages/torch/onnx/init.py in export(*args, **kwargs)
25 def export(*args, **kwargs):
26     from torch.onnx import utils
—> 27     return utils.export(*args, **kwargs)
28
29
/usr/local/lib/python3.6/dist-packages/torch/onnx/utils.py in export(model, args, f, export_params, verbose, training, input_names, output_names, aten, export_raw_ir, operator_export_type)
102             operator_export_type = OperatorExportTypes.ONNX
103     _export(model, args, f, export_params, verbose, training, input_names, output_names,
–> 104             operator_export_type=operator_export_type)
105
106
/usr/local/lib/python3.6/dist-packages/torch/onnx/utils.py in _export(model, args, f, export_params, verbose, training, input_names, output_names, operator_export_type, export_type, example_outputs, propagate)
279                                                training, input_names,
280                                                output_names, operator_export_type,
–> 281                                                example_outputs, propagate)
282
283     # TODO: Don’t allocate a in-memory string for the protobuf
/usr/local/lib/python3.6/dist-packages/torch/onnx/utils.py in _model_to_graph(model, args, f, verbose, training, input_names, output_names, operator_export_type, example_outputs, propagate)
222             raise RuntimeError(’‘forward’ method must be a script method’)
223     else:
–> 224         graph, torch_out = _trace_and_get_graph_from_model(model, args, training)
225         params = list(_unique_state_dict(model).values())
226
/usr/local/lib/python3.6/dist-packages/torch/onnx/utils.py in _trace_and_get_graph_from_model(model, args, training)
190     # training mode was.)
191     with set_training(model, training):
–> 192         trace, torch_out = torch.jit.get_trace_graph(model, args, _force_outplace=True)
193
194     if orig_state_dict_keys != _unique_state_dict(model).keys():
/usr/local/lib/python3.6/dist-packages/torch/jit/init.py in get_trace_graph(f, args, kwargs, _force_outplace)
195     if not isinstance(args, tuple):
196         args = (args,)
–> 197     return LegacyTracedModule(f, _force_outplace)(*args, **kwargs)
198
199
/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
487             result = self._slow_forward(*input, **kwargs)
488         else:
–> 489             result = self.forward(*input, **kwargs)
490         for hook in self._forward_hooks.values():
491             hook_result = hook(self, input, result)
/usr/local/lib/python3.6/dist-packages/torch/jit/init.py in forward(self, *args)
250         try:
251             trace_inputs = _unflatten(all_trace_inputs[:len(in_vars)], in_desc)
–> 252             out = self.inner(*trace_inputs)
253             out_vars, _ = _flatten(out)
254             torch._C._tracer_exit(tuple(out_vars))
/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
485             hook(self, input)
486         if torch._C._get_tracing_state():
–> 487             result = self._slow_forward(*input, **kwargs)
488         else:
489             result = self.forward(*input, **kwargs)
/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py in _slow_forward(self, *input, **kwargs)
475         tracing_state._traced_module_stack.append(self)
476         try:
–> 477             result = self.forward(*input, **kwargs)
478         finally:
479             tracing_state.pop_scope()
TypeError: forward() missing 1 required positional argument: ‘hidden’