def __init__(self, input_size, hidden_size): super(GRU, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.weight_i, self.weight_h, self.bias_i, self.bias_h = gru_default_state( self.input_size, self.hidden_size) self.rnn = P.DynamicGRUV2() self.cast = P.Cast()
def __init__(self, config, is_training=True): super(GRU, self).__init__() if is_training: self.batch_size = config.batch_size else: self.batch_size = config.eval_batch_size self.hidden_size = config.hidden_size self.weight_i, self.weight_h, self.bias_i, self.bias_h = \ gru_default_state(self.batch_size, self.hidden_size, self.hidden_size) self.rnn = P.DynamicGRUV2() self.cast = P.Cast()
def __init__(self): super(DynamicGRUV2, self).__init__() self.dynamic_gru = P.DynamicGRUV2()