Python keras.layers 模块,Recurrent() 实例源码

我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用keras.layers.Recurrent()

项目:EUNN-theano    作者:iguanaus    | 项目源码 | 文件源码
def preprocess_input(self, x):
        if self.consume_less == 'cpu':
            input_shape = self.input_spec[0].shape
            input_dim = input_shape[2]
            timesteps = input_shape[1]
            return time_distributed_dense(x, self.W, None, self.dropout_W,
                                          input_dim, self.output_dim,
                                          timesteps)
        else:
            return x

    # override Recurrent's get_initial_states function to load the trainable
    # initial hidden state
项目:urnn    作者:stwisdom    | 项目源码 | 文件源码
def preprocess_input(self, x):
        if self.consume_less == 'cpu':
            input_shape = self.input_spec[0].shape
            input_dim = input_shape[2]
            timesteps = input_shape[1]
            return time_distributed_dense(x, self.W, None, self.dropout_W,
                                          input_dim, self.output_dim,
                                          timesteps)
        else:
            return x

    # override Recurrent's get_initial_states function to load the trainable
    # initial hidden state