(self, input_size, context_size, rnn=nn.GRU, num_layers=1, dropout=0.0,
                 bidirectional=False, bias=True, batch_first=True)
Context-level Encoder
Context-level Encoder
Context - level Encoder
def __init__(self, input_size, context_size, rnn=nn.GRU, num_layers=1, dropout=0.0,
                 bidirectional=False, bias=True, batch_first=True):
        """Context-level Encoder"""
        super(ContextRNN, self).__init__()

        self.input_size = input_size
        self.context_size = context_size
        self.hidden_size = self.context_size
        self.num_layers = num_layers
        self.dropout = dropout
        self.bidirectional = bidirectional
        self.batch_first = batch_first

        if bidirectional:
            self.num_directions = 2
        else:
            self.num_directions = 1

        self.rnn = rnn(input_size=input_size,
                        hidden_size=context_size,
                        num_layers=num_layers,
                        bias=bias,
                        batch_first=batch_first,
                        dropout=dropout,
                        bidirectional=bidirectional)
def __init__ ( self , input_size , context_size , rnn = nn . GRU , num_layers = 1 , dropout = 0.0 , bidirectional = False , bias = True , batch_first = True ) : super ( ContextRNN , self ) . __init__ ( ) self . input_size = input_size self . context_size = context_size self . hidden_size = self . context_size self . num_layers = num_layers self . dropout = dropout self . bidirectional = bidirectional self . batch_first = batch_first if bidirectional : self . num_directions = 2 else : self . num_directions = 1 self . rnn = rnn ( input_size = input_size , hidden_size = context_size , num_layers = num_layers , bias = bias , batch_first = batch_first , dropout = dropout , bidirectional = bidirectional )