Excepted a single top-level function

I am trying to use torch.jit to build a serialized model.
But I got a bug called: excepted a single top-level function, like:

Traceback (most recent call last):
File “train_Kinetics.py”, line 100, in
model = SNN(batch_norm=True, num_action=opt.class_num, dropout=opt.dropout, detachout=opt.detachout, img_size=opt.img_size, syn_bn=opt.syn_bn, test_scheme=3)
File “/home/poli/anaconda2/envs/pytorch1.0/lib/python2.7/site-packages/torch/jit/init.py”, line 951, in init_then_register
_create_methods_from_stubs(self, methods)
File “/home/poli/anaconda2/envs/pytorch1.0/lib/python2.7/site-packages/torch/jit/init.py”, line 912, in _create_methods_from_stubs
self._create_methods(defs, rcbs, defaults)
File “/home/poli/anaconda2/envs/pytorch1.0/lib/python2.7/site-packages/torch/jit/annotations.py”, line 67, in get_num_params
raise RuntimeError(“expected a single top-level function”)
RuntimeError: expected a single top-level function

The error encountered is from this part of the pytorch script. So looking at this might help you. In cases like this, the error mainly depends on the script so it would be helpful if you acn upload the script :smile: