e74a5d43d931a182023566f1640bb8ec09a655c2,deepchem/models/tensorflow_models/__init__.py,TensorflowGraph,add_training_cost,#TensorflowGraph#,162

Before Change


        with self._shared_name_scope("aggregated"):
          with tf.name_scope("gradient"):
            loss = tf.add_n(gradient_costs)
          with tf.name_scope("old_cost"):
            old_loss = tf.add_n(old_costs)

          // weight decay
          if model_params["penalty"] != 0.0:
            penalty = model_ops.WeightDecay(model_params)
            loss += penalty
            old_loss += penalty

After Change


              // calculate with div/sum so it stays on the GPU.
              print("model_params["batch_size"]")
              print(model_params["batch_size"])
              print("weighted_cost")
              print(weighted_cost)
              gradient_cost = tf.div(tf.reduce_sum(weighted_cost),
                                     model_params["batch_size"])
              gradient_costs.append(gradient_cost)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: deepchem/deepchem
Commit Name: e74a5d43d931a182023566f1640bb8ec09a655c2
Time: 2016-04-29
Author: bharath.ramsundar@gmail.com
File Name: deepchem/models/tensorflow_models/__init__.py
Class Name: TensorflowGraph
Method Name: add_training_cost


Project Name: reinforceio/tensorforce
Commit Name: d75d3002186f4bac61966dece60a908cd85a5e7c
Time: 2016-11-14
Author: mi.schaarschmidt@gmail.com
File Name: tensorforce/value_functions/deep_q_network.py
Class Name: DeepQNetwork
Method Name: create_training_operations


Project Name: deepchem/deepchem
Commit Name: cd648e6252104018c89693dd4ca3a14d93ab6669
Time: 2016-09-19
Author: bharath.ramsundar@gmail.com
File Name: deepchem/models/tensorflow_models/__init__.py
Class Name: TensorflowGraphModel
Method Name: construct_graph