Also just FYI @torch.jit.ignore functions cannot be exported, if you do scripted_module.save("out.pt") you’ll get
Traceback (most recent call last):
  File "../test.py", line 196, in <module>
    scripted_module.save('s.pt')
  File "/home/pytorch/torch/jit/__init__.py", line 1621, in save
    return self._c.save(*args, **kwargs)
RuntimeError: 
Could not export Python function call 'get_rand'. Remove calls to Python functions before export. Did you forget add @script or @script_method annotation? If this is a nn.ModuleList, add it to __constants__:
  File "../test.py", line 192
    @torch.jit.export
    def func(self):
        done = self.get_rand()
               ~~~~~~~~~~~~~ <--- HERE
        print (done)

Which is expected behavior (since saved models are expected to run without a Python runtime attached)