b49e30bb44db15ee1483f4cd1451f8e59243131a,tpu/templates/tpu_rewrite/trainer.py,,main,#Any#,79

Before Change


    sess = tf.Session(tpu_grpc_url)

    sess.run(tf.contrib.tpu.initialize_system())
    sess.run(tf.global_variables_initializer())

    for i in range(args.max_steps):
        // the tensor values in the TPU function are returned in a list, and the operations in the TPU function are called with no return value
        global_step, loss = sess.run(train_on_tpu)

After Change


        save_steps=args.save_checkpoints_steps,
    )

    summary = tf.summary.scalar("loss", loss_tensor)

    summary_saver_hook = tf.train.SummarySaverHook(
        save_steps=args.save_checkpoints_steps,
        output_dir=args.model_dir,
        summary_op=summary
    )

    // loss_summary = tf.summary.scalar("loss", loss_tensor)
    // summary = tf.summary.merge_all()

    // get the TPU resource"s grpc url
    // Note: when running on CMLE, args.tpu should be left as None
    tpu_grpc_url = TPUClusterResolver(tpu=args.tpu).get_master()
    // sess = tf.Session(tpu_grpc_url)
    sess = tf.train.MonitoredSession(
        session_creator=tf.train.ChiefSessionCreator(master=tpu_grpc_url),
        hooks=[checkpoint_saver_hook, summary_saver_hook]
    )
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: GoogleCloudPlatform/cloudml-samples
Commit Name: b49e30bb44db15ee1483f4cd1451f8e59243131a
Time: 2018-09-25
Author: yuhanliu@google.com
File Name: tpu/templates/tpu_rewrite/trainer.py
Class Name:
Method Name: main


Project Name: GoogleCloudPlatform/cloudml-samples
Commit Name: b49e30bb44db15ee1483f4cd1451f8e59243131a
Time: 2018-09-25
Author: yuhanliu@google.com
File Name: tpu/templates/tpu_rewrite/trainer.py
Class Name:
Method Name: main


Project Name: arnomoonens/yarll
Commit Name: 86ce5d52134a56806112ff8664e4034338e0e05a
Time: 2019-03-21
Author: arno.moonens@gmail.com
File Name: yarll/agents/ppo/ppo.py
Class Name: PPO
Method Name: learn


Project Name: arnomoonens/yarll
Commit Name: 2b77a13f3870712284122f2a5411c7d4b8db82e6
Time: 2019-06-09
Author: arno.moonens@gmail.com
File Name: yarll/agents/sac.py
Class Name: SAC
Method Name: learn