811d018ccb0cc49ce7c3b3b37849bff07c865761,tflearn/layers/core.py,,fully_connected,#,78
Before Change
n_inputs = int(np.prod(input_shape[1:]))
// Build variables and inference.
with tf.name_scope(name) as scope:
W_init = weights_init
if isinstance(weights_init, str):
W_init = initializations.get(weights_init)()
W_regul = None
if regularizer:
W_regul = lambda x: losses.get(regularizer)(x, weight_decay)
W = va.variable(scope + "W", shape=[n_inputs, n_units],
regularizer=W_regul, initializer=W_init,
trainable=trainable, restore=restore)
tf.add_to_collection(tf.GraphKeys.LAYER_VARIABLES + "/" + scope, W)
b = None
if bias:
b_init = initializations.get(bias_init)()
b = va.variable(scope + "b", shape=[n_units],
initializer=b_init, trainable=trainable,
restore=restore)
tf.add_to_collection(tf.GraphKeys.LAYER_VARIABLES + "/" + scope, b)
inference = incoming
// If input is not 2d, flatten it.
if len(input_shape) > 2:
inference = tf.reshape(inference, [-1, n_inputs])
inference = tf.matmul(inference, W)
if b: inference = tf.nn.bias_add(inference, b)
if isinstance(activation, str):
inference = activations.get(activation)(inference)
elif hasattr(activation, "__call__"):
inference = activation(inference)
else:
raise ValueError("Invalid Activation.")
// Track activations.
tf.add_to_collection(tf.GraphKeys.ACTIVATIONS, inference)
// Add attributes to Tensor to easy access weights.
inference.scope = scope
inference.W = W
inference.b = b
return inference
After Change
n_inputs = int(np.prod(input_shape[1:]))
// Build variables and inference.
with tf.variable_op_scope([incoming], scope, name, reuse=reuse) as scope:
name = scope.name
W_init = weights_init
if isinstance(weights_init, str):
W_init = initializations.get(weights_init)()
In pattern: SUPERPATTERN
Frequency: 5
Non-data size: 15
Instances
Project Name: tflearn/tflearn
Commit Name: 811d018ccb0cc49ce7c3b3b37849bff07c865761
Time: 2016-06-23
Author: aymeric.damien@gmail.com
File Name: tflearn/layers/core.py
Class Name:
Method Name: fully_connected
Project Name: tflearn/tflearn
Commit Name: 811d018ccb0cc49ce7c3b3b37849bff07c865761
Time: 2016-06-23
Author: aymeric.damien@gmail.com
File Name: tflearn/layers/conv.py
Class Name:
Method Name: conv_3d
Project Name: tflearn/tflearn
Commit Name: 811d018ccb0cc49ce7c3b3b37849bff07c865761
Time: 2016-06-23
Author: aymeric.damien@gmail.com
File Name: tflearn/layers/core.py
Class Name:
Method Name: fully_connected
Project Name: tflearn/tflearn
Commit Name: 811d018ccb0cc49ce7c3b3b37849bff07c865761
Time: 2016-06-23
Author: aymeric.damien@gmail.com
File Name: tflearn/layers/conv.py
Class Name:
Method Name: conv_2d_transpose
Project Name: tflearn/tflearn
Commit Name: 811d018ccb0cc49ce7c3b3b37849bff07c865761
Time: 2016-06-23
Author: aymeric.damien@gmail.com
File Name: tflearn/layers/conv.py
Class Name:
Method Name: conv_2d
Project Name: tflearn/tflearn
Commit Name: 811d018ccb0cc49ce7c3b3b37849bff07c865761
Time: 2016-06-23
Author: aymeric.damien@gmail.com
File Name: tflearn/layers/core.py
Class Name:
Method Name: single_unit