Ejemplo n.º 1
0
 def model(self, x, is_training):
     op = ops.get_n_hidden_layers(x,
                                  self.hidden_layer_list,
                                  self.activation_list,
                                  initializer='xavier')
     return ops.get_hidden_layer(op,
                                 'output_layer',
                                 self.no_of_classes,
                                 'none',
                                 initializer='xavier')
    def get_model(self, x, is_training):

        if isinstance(self.cell_size, list):
            rnn_layers = [
                tf.nn.rnn_cell.LSTMCell(self.cell_size[i], name=str(i))
                for i in range(len(self.cell_size))
            ]
            multi_rnn_cell = tf.nn.rnn_cell.MultiRNNCell(rnn_layers)
        elif isinstance(self.cell_size, int):
            rnn_layers = [
                tf.nn.rnn_cell.LSTMCell(self.cell_size, name=str(i))
                for i in range(self.no_of_cell)
            ]
            multi_rnn_cell = tf.nn.rnn_cell.MultiRNNCell(rnn_layers)

        outputs, states = tf.nn.dynamic_rnn(cell=multi_rnn_cell,
                                            inputs=x,
                                            dtype=tf.float32)

        op = tf.gather(outputs, int(outputs.get_shape()[1]) - 1, axis=1)
        op = ops.get_n_hidden_layers(op, '', self.hidden_layers,
                                     self.activation_list)
        return ops.get_hidden_layer(op, 'output_layer', 1, 'none')
 def get_decoder(self,x,is_training):
     return ops.get_n_hidden_layers(x,'decoder',self.decoder_hidden_layers+[self.no_of_features],self.decoder_activation_list+['none'],'xavier')
 def get_encoder(self,x,is_training):
     return ops.get_n_hidden_layers(x,'encoder',self.encoder_hidden_layers,self.encoder_activation_list,'xavier')
Ejemplo n.º 5
0
 def get_model(self,x,is_training):
     op=ops.get_n_hidden_layers(x,'',self.hidden_layers,self.activation_list)
     return ops.get_hidden_layer(op,'output_layer',1,'none')