def _validate_args(self, inputs, encoder_hidden, encoder_outputs, function, teacher_forcing_ratio):
    if self.use_attention:
        if (encoder_outputs is None):
            raise ValueError('Argument encoder_outputs cannot be None when attention is used.')
    if ((inputs is None) and (encoder_hidden is None)):
        batch_size = 1
    elif (inputs is not None):
        batch_size = inputs.size(0)
    elif (self.rnn_cell is nn.LSTM):
        batch_size = encoder_hidden[0].size(1)
    elif (self.rnn_cell is nn.GRU):
        batch_size = encoder_hidden.size(1)
    if (inputs is None):
        if (teacher_forcing_ratio > 0):
            raise ValueError('Teacher forcing has to be disabled (set 0) when no inputs is provided.')
        inputs = Variable(torch.LongTensor(([self.sos_id] * batch_size)), volatile=True).view(batch_size, 1)
        if torch.cuda.is_available():
            inputs = inputs.cuda()
        max_length = self.max_length
    else:
        max_length = (inputs.size(1) - 1)
    return (inputs, batch_size, max_length)
def _validate_args(self, inputs, encoder_hidden, encoder_outputs, function, teacher_forcing_ratio):
    if self.use_attention:
        if (encoder_outputs is None):
            raise ValueError('Argument encoder_outputs cannot be None when attention is used.')
    if ((inputs is None) and (encoder_hidden is None)):
        batch_size = 1
    elif (inputs is not None):
        batch_size = inputs.size(0)
    elif (self.rnn_cell is nn.LSTM):
        batch_size = encoder_hidden[0].size(1)
    elif (self.rnn_cell is nn.GRU):
        batch_size = encoder_hidden.size(1)
    if (inputs is None):
        if (teacher_forcing_ratio > 0):
            raise ValueError('Teacher forcing has to be disabled (set 0) when no inputs is provided.')
        inputs = Variable(torch.LongTensor(([self.sos_id] * batch_size)), volatile=True).view(batch_size, 1)
        if torch.cuda.is_available():
            inputs = inputs.cuda()
        max_length = self.max_length
    else:
        max_length = (inputs.size(1) - 1)
    return (inputs, batch_size, max_length)