78c163f37be165673b040cff49e1ee98eb89ca0f,tf_agents/bandits/agents/examples/v2/trainer.py,,train,#Any#Any#Any#Any#Any#Any#Any#,104

Before Change


    metric_utils.log_metrics(metrics)
    for metric in metrics:
      tf.summary.scalar(
          metric.name, metric.result(), step=step_metric.result())
    checkpoint_manager.save()
    saver.save(os.path.join(root_dir, "policy_%d" % step_metric.result()))

After Change


      tf_metrics.AverageEpisodeLengthMetric(batch_size=environment.batch_size)
  ] + list(additional_metrics)

  if isinstance(environment.reward_spec(), dict):
    metrics += [tf_metrics.AverageReturnMultiMetric(
        reward_spec=environment.reward_spec(),
        batch_size=environment.batch_size)]
  else:
    metrics += [
        tf_metrics.AverageReturnMetric(batch_size=environment.batch_size)]

  if training_data_spec_transformation_fn is not None:
    add_batch_fn = lambda data: replay_buffer.add_batch(  // pylint: disable=g-long-lambda
        training_data_spec_transformation_fn(data))
  else:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: tensorflow/agents
Commit Name: 78c163f37be165673b040cff49e1ee98eb89ca0f
Time: 2020-06-12
Author: kokiopou@google.com
File Name: tf_agents/bandits/agents/examples/v2/trainer.py
Class Name:
Method Name: train


Project Name: keras-team/keras
Commit Name: 00135a70697dc9b4611971e5833e2d84501c3da7
Time: 2021-03-23
Author: scottzhu@google.com
File Name: keras/engine/training.py
Class Name: Model
Method Name: test_step


Project Name: keras-team/keras
Commit Name: 00135a70697dc9b4611971e5833e2d84501c3da7
Time: 2021-03-23
Author: scottzhu@google.com
File Name: keras/engine/training.py
Class Name: Model
Method Name: train_step