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

Before Change


class MyModel(TFModel):
    An example of a tf model class 
    def _build(self, *args, **kwargs):
        num_features = 3
        num_classes = 3
        x = tf.placeholder("float", [None, num_features], name="x")
        y = tf.placeholder("int32",[None], name="y")
        y_oe = tf.one_hot(y, num_classes)

        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)

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

        print("___________________ MyModel initialized")

After Change


class MyModel(TFModel):
    An example of a tf model class 
    def _build(self, *args, **kwargs):
        images_shape = kwargs.get("images_shape")
        num_features =  images_shape[-1] if images_shape is not None else 3
        num_classes = kwargs.get("num_classes", 3)

        x = tf.placeholder("float", [None, num_features], name="x")
        y = tf.placeholder("int32",[None], name="y")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


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


Project Name: tensorflow/tensorflow
Commit Name: b87589cd9adfc43f62365fd4bcb06ea47c589a8c
Time: 2021-04-22
Author: rxsang@google.com
File Name: tensorflow/python/ops/losses/losses_impl.py
Class Name:
Method Name: mean_pairwise_squared_error


Project Name: tensorflow/tensorflow
Commit Name: b87589cd9adfc43f62365fd4bcb06ea47c589a8c
Time: 2021-04-22
Author: rxsang@google.com
File Name: tensorflow/python/ops/losses/losses_impl.py
Class Name:
Method Name: compute_weighted_loss