563207ae6bd9a8565243b04dcd92af9c33bac524,deepchem/models/keras_model.py,KerasModel,fit_generator,#KerasModel#Any#Any#Any#Any#Any#Any#Any#,246

Before Change


          inputs = inputs[0]
        outputs = self.model(inputs)
        if isinstance(outputs, tf.Tensor):
          outputs = [outputs]
        if self._loss_outputs is not None:
          outputs = [outputs[i] for i in self._loss_outputs]
        batch_loss = loss(outputs, labels, weights)
      if variables is None:
        vars = self.model.trainable_variables
      else:

After Change


      loss = self._loss_fn
    var_key = None
    if variables is not None:
      var_key = tuple(v.experimental_ref() for v in variables)

      // The optimizer creates internal variables the first time apply_gradients()
      // is called for a new set of variables.  If that happens inside a function
      // annotated with tf.function it throws an exception, so call it once here.

      zero_grads = [tf.zeros(v.shape) for v in variables]
      self._tf_optimizer.apply_gradients(zip(zero_grads, variables))
    if var_key not in self._gradient_fn_for_vars:
      self._gradient_fn_for_vars[var_key] = self._create_gradient_fn(variables)
    apply_gradient_for_batch = self._gradient_fn_for_vars[var_key]
    time1 = time.time()

    // Main training loop.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 8

Instances


Project Name: deepchem/deepchem
Commit Name: 563207ae6bd9a8565243b04dcd92af9c33bac524
Time: 2020-02-12
Author: peastman@stanford.edu
File Name: deepchem/models/keras_model.py
Class Name: KerasModel
Method Name: fit_generator


Project Name: deepchem/deepchem
Commit Name: 563207ae6bd9a8565243b04dcd92af9c33bac524
Time: 2020-02-12
Author: peastman@stanford.edu
File Name: deepchem/models/keras_model.py
Class Name: KerasModel
Method Name: fit_generator


Project Name: daniellerch/aletheia
Commit Name: e7eefe879b9e5b7a279d80588af59d08f21365a1
Time: 2020-11-01
Author: kevin.clark@gmail.com
File Name: aletheialib/attacks.py
Class Name:
Method Name: difference


Project Name: 10XGenomics/cellranger
Commit Name: b47a6f858f4a224518f7c88b48ebce516c5a5f51
Time: 2019-02-20
Author: hezx@users.noreply.github.com
File Name: mro/stages/aggregator/merge_molecules/__init__.py
Class Name:
Method Name: split


Project Name: tensorflow/cleverhans
Commit Name: f7715f63c17832f66e54164cc0ae3cb0e4afc4a3
Time: 2017-07-09
Author: nicholas@carlini.com
File Name: cleverhans/attacks.py
Class Name: Attack
Method Name: generate_np