Freeze_module pass for 1.4.x version of PyTorch

I see that there is a freeze_module pass in 1.5.x and later in PyTorch.

Is there a similar pass in 1.4.x version of PyTorch which inlines the graph and resolves the weights and biases in the PyTorch graph into constants?

Does running _jit_pass_lower_graph(), and converting all the tensor parameters returned by this pass into constants in the graph have the same effect?

The freeze_module pass was added to 1.5, so there isn’t anything 100% equivalent in 1.4 The _jit_pass_lower_graph does something similar but freezing goes beyond it to try to simplify the graph based on the changes, and to verify that the conversion to constants was a correct transform.

@zdevito : Thanks for the reply. If I had to achieve something similar to freeze_module in PyTorch 1.4.x, is running _jit_pass_lower_graph() and converting the returned parameters into graph constants a good approach? Or is there a better mechanism to achieve this? Porting freeze_module to 1.4.x seems cumbersome as it relies on AliasDB APIs which don’t exist in 1.4.x.