Ejemplo n.º 1
0
    def apply_OutputNN(inputs, activation_type):
        activation_fun = nn_utils.get_activation_fun(activation_type)
        with tf.variable_scope('hidden1') as scope:
            weights = tf.get_variable("weights")
            biases = tf.get_variable("biases")
            hidden1 = activation_fun(tf.matmul(inputs, weights) + biases)

        with tf.variable_scope('output') as scope:
            weights = tf.get_variable("weights")
            return tf.matmul(hidden1, weights)
Ejemplo n.º 2
0
    def apply_OutputNN(inputs, hidden_activation_type, output_activation_type):
        '''
        output_activation_type:

            e.g. use None (==linear) for regression problems

        '''
        hidden_activation_type = nn_utils.get_activation_fun(hidden_activation_type)
        output_activation_type = nn_utils.get_activation_fun(output_activation_type)

        with tf.variable_scope('hidden1') as scope:
            weights = tf.get_variable("weights")
            biases = tf.get_variable("biases")
            hidden1 = hidden_activation_type(tf.matmul(inputs, weights) + biases)


        with tf.variable_scope('output') as scope:
            weights = tf.get_variable("weights")
            out = tf.matmul(hidden1, weights)
            if output_activation_type is not None:
                return output_activation_type(out)
            return out