This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Encoder(nn.Module): | |
def __init__(self, input_size, hidden_size, bidirectional = True): | |
super(Encoder, self).__init__() | |
self.hidden_size = hidden_size | |
self.input_size = input_size | |
self.bidirectional = bidirectional | |
self.lstm = nn.LSTM(input_size, hidden_size, bidirectional = bidirectional) | |
def forward(self, inputs, hidden): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import torch.nn as nn | |
from torch import optim | |
import torch.nn.functional as F | |
from torch.autograd import Variable |