class BidirectionalLSTM(torch.jit.ScriptModule):
    # Inputs hidden units Out
    def __init__(self, nIn, nHidden, nOut):
        super(BidirectionalLSTM, self).__init__()

        self.rnn = nn.LSTM(nIn, nHidden, bidirectional=True)
        self.embedding = nn.Linear(nHidden * 2, nOut)

    @torch.jit.script_method
    def forward(self, input):
        recurrent, _ = self.rnn(input)
        T, b, h = recurrent.size()
        t_rec = recurrent.view(T * b, h)

        output = self.embedding(t_rec)  # [T * b, nOut]
        output = output.view(T, b, -1)

        return output

net = BidirectionalLSTM(256,256, 512)
net.save('model.pt')

got the error:
Traceback (most recent call last):
  File "/home/xxh/Desktop/crnn/models/test.py", line 24, in <module>
    net.save('model.pt')
RuntimeError: 
could not export python function call <python_value>. Remove calls to python functions before export.:
@torch.jit.script_method
def forward(self, input):
    recurrent, _ = self.rnn(input)
                   ~~~~~~~~ <--- HERE
    T, b, h = recurrent.size()
    t_rec = recurrent.view(T * b, h)

    output = self.embedding(t_rec)  # [T * b, nOut]
    output = output.view(T, b, -1)

    return output