Calling lstm.flatten_parameters() in torch.jit.script_method

I’m getting the error below when calling flatten_parameters on a lstm inside script_method inside a ScriptModule

attribute 'flatten_parameters' of type 'NoneType' is not usable in a script method (did you forget to add it __constants__?):
def inference(self, x):
    for conv in self.convolutions:
        x = F.dropout(F.relu(conv(x)), 0.5, False)

    x = x.transpose(1, 2)

    ~~~~~~~~~~~~~~~~~ <--- HERE