Sorry, I’m forgot to save changes in module 
Now, when I try to export to Onnnx this model with above get_item(beam_size) scripted function, I got
RuntimeError: Tracer cannot set value trace for type Int. Supported types are tensor, tensor list, and tuple of tensors.
Is it problem from Onnx-part, or am I doing something wrong with torch.script and it leads to errors?