8f74f45d3a17b6f53d11516df43062f5a69381b4,examples/basic_tutorials/2_mnist_mlp_graph_mode_model2layer.py,,,#,43

Before Change


//// get output tensors for training and testing
// 1) use ``is_train""
y1 = MLP(x, is_train=True).outputs
y2 = MLP(x, is_train=False).outputs
// 2) alternatively, you can use the switching method
// MLP.train()
// y1 = MLP(x).outputs
// MLP.eval()
// y2 = MLP(x).outputs

//// cost and optimizer for training
cost = tl.cost.cross_entropy(y1, y_, name="train_loss")
train_weights = MLP.weights  //tl.layers.get_variables_with_name("MLP", True, False)
train_op = tf.train.AdamOptimizer(learning_rate=0.0001).minimize(cost, var_list=train_weights)

//// cost and accuracy for evaluation
cost_test = tl.cost.cross_entropy(y2, y_, name="test_loss")
correct_prediction = tf.equal(tf.argmax(y2, 1), y_)
acc = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))

//// initialize all variables in the session

After Change


//// get output tensors for training and testing
// 1) use ``is_train""
y1 = MLP(x, is_train=True)
y2 = MLP(x, is_train=False)
// 2) alternatively, you can use the switching method
// MLP.train()
// y1 = MLP(x)
// MLP.eval()
// y2 = MLP(x)

//// cost and optimizer for training
cost = tl.cost.cross_entropy(y1, y_, name="train_loss")
train_weights = MLP.weights  //tl.layers.get_variables_with_name("MLP", True, False)
train_op = tf.train.AdamOptimizer(learning_rate=0.0001).minimize(cost, var_list=train_weights)

//// cost and accuracy for evaluation
cost_test = tl.cost.cross_entropy(y2, y_, name="test_loss")
correct_prediction = tf.equal(tf.argmax(y2, 1), y_)
acc = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))

//// initialize all variables in the session
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 5

Non-data size: 9

Instances


Project Name: tensorlayer/tensorlayer
Commit Name: 8f74f45d3a17b6f53d11516df43062f5a69381b4
Time: 2019-02-24
Author: jingqing.zhang15@imperial.ac.uk
File Name: examples/basic_tutorials/2_mnist_mlp_graph_mode_model2layer.py
Class Name:
Method Name:


Project Name: tensorlayer/tensorlayer
Commit Name: 8f74f45d3a17b6f53d11516df43062f5a69381b4
Time: 2019-02-24
Author: jingqing.zhang15@imperial.ac.uk
File Name: examples/basic_tutorials/1_mnist_mlp_eager_mode_model2layer.py
Class Name:
Method Name:


Project Name: tensorlayer/tensorlayer
Commit Name: 8f74f45d3a17b6f53d11516df43062f5a69381b4
Time: 2019-02-24
Author: jingqing.zhang15@imperial.ac.uk
File Name: examples/basic_tutorials/4_mnist_mlp_eager_mode_dynamic.py
Class Name:
Method Name:


Project Name: tensorlayer/tensorlayer
Commit Name: 8f74f45d3a17b6f53d11516df43062f5a69381b4
Time: 2019-02-24
Author: jingqing.zhang15@imperial.ac.uk
File Name: examples/basic_tutorials/1_mnist_mlp_eager_mode.py
Class Name:
Method Name:


Project Name: tensorlayer/tensorlayer
Commit Name: 8f74f45d3a17b6f53d11516df43062f5a69381b4
Time: 2019-02-24
Author: jingqing.zhang15@imperial.ac.uk
File Name: examples/basic_tutorials/2_mnist_mlp_graph_mode.py
Class Name:
Method Name: