f02b56207713275c749ff7c0d337c49bd3dffe53,examples/simple_but_ugly/tf_models.py,MyModel,_build,#MyModel#,16

Before Change


        y = tf.placeholder("int32",[None], name="y")
        y_oe = tf.one_hot(y, num_classes, name="targets")

        w = tf.Variable(tf.zeros([num_features, num_classes]))
        b = tf.Variable(tf.zeros([num_classes]))

        y_ = tf.nn.softmax(tf.matmul(x, w) + b, name="predictions")

        // Define a cost function
        //tf.losses.add_loss(tf.losses.softmax_cross_entropy(y_oe, y_))
        loss = tf.losses.softmax_cross_entropy(y_oe, y_)

After Change


        images_shape = self.get_from_config("images_shape", (12, 12, 1))
        num_classes = self.get_from_config("num_classes", 3)

        x = tf.placeholder("float", [None] + list(images_shape), name="x")
        y = tf.placeholder("int32",[None], name="y")
        y_oe = tf.one_hot(y, num_classes, name="targets")

        c = conv2d_block(x, 32, 3, conv=dict(kernel_initializer=tf.contrib.layers.xavier_initializer()), max_pooling=dict(strides=4))
        f = flatten(c)
        f = tf.layers.dense(f, num_classes)
        y_ = tf.identity(f, name="predictions")

        // Define a cost function
        //tf.losses.add_loss(tf.losses.softmax_cross_entropy(y_oe, y_))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: analysiscenter/batchflow
Commit Name: f02b56207713275c749ff7c0d337c49bd3dffe53
Time: 2017-10-24
Author: rhudor@gmail.com
File Name: examples/simple_but_ugly/tf_models.py
Class Name: MyModel
Method Name: _build


Project Name: pytorch/examples
Commit Name: 645c7c386e62d2fb1d50f4621c1a52645a13869f
Time: 2018-04-24
Author: soumith@gmail.com
File Name: fast_neural_style/neural_style/neural_style.py
Class Name:
Method Name: stylize


Project Name: cornellius-gp/gpytorch
Commit Name: 7c5e80b3dc2187b5d67a45240ea9dc092114d131
Time: 2017-08-30
Author: gpleiss@gmail.com
File Name: gpytorch/lazy/kronecker_product_lazy_variable.py
Class Name: KroneckerProductLazyVariable
Method Name: exact_gp_marginal_log_likelihood


Project Name: kengz/SLM-Lab
Commit Name: 4df11055e61fa6c9fede6b2114c8ce05de9a035e
Time: 2017-12-08
Author: lgraesser@users.noreply.github.com
File Name: slm_lab/agent/algorithm/dqn.py
Class Name: DQNBase
Method Name: compute_q_target_values