def PyTorchBiLSTM(nO, nI, depth, dropout=0.2): import torch.nn from thinc.api import with_square_sequences from thinc.extra.wrappers import PyTorchWrapperRNN if depth == 0: return layerize(noop()) model = torch.nn.LSTM(nI, nO // 2, depth, bidirectional=True, dropout=dropout) return with_square_sequences(PyTorchWrapperRNN(model))
def PyTorchBiLSTM(nO, nI, depth, dropout=0.2): if depth == 0: return layerize(noop()) model = torch.nn.LSTM(nI, nO // 2, depth, bidirectional=True, dropout=dropout) return with_square_sequences(PyTorchWrapperRNN(model))
def TorchBiLSTMEncoder(config): import torch.nn from thinc.extra.wrappers import PyTorchWrapperRNN width = config["width"] depth = config["depth"] if depth == 0: return layerize(noop()) return with_square_sequences( PyTorchWrapperRNN(torch.nn.LSTM(width, width // 2, depth, bidirectional=True)) )
def PyTorchBiLSTM(nO, nI, depth, dropout=0.2): if depth == 0: return layerize(noop()) model = torch.nn.LSTM(nI, nO // 2, depth, bidirectional=True, dropout=dropout) return with_square_sequences(PyTorchWrapperRNN(model))
def PyTorchBiLSTM(nO, nI, depth): model = torch.nn.LSTM(nI, nO // 2, depth, bidirectional=True) return with_square_sequences(PyTorchWrapperRNN(model))
def PyTorchBiLSTM(nO, nI, depth): model = torch.nn.LSTM(nI, nO // 2, depth, bidirectional=True) return with_square_sequences(PyTorchWrapperRNN(model))