LoginSignup
0
0

More than 5 years have passed since last update.

クラウドサーバでTensorFlow その3

Last updated at Posted at 2017-07-07

概要

クラウドサーバでTensorFlowやってみた。
restoreして、global_stepを保存するやつ。

環境

クラウド idcf
linux debian-8.11
tensorflow 1.2
gpu 無し

サンプルコード

import os
import tensorflow as tf


global_step = tf.Variable(0, trainable = False)
saver = tf.train.Saver()
with tf.Session() as sess:
    tf.global_variables_initializer().run()
    ckpt = tf.train.get_checkpoint_state(os.getcwd())
    if ckpt:
        print ("restore")
        saver.restore(sess, ckpt.model_checkpoint_path)
        step = global_step.eval()
    else:
        step = 0        
    for i in range(6):
        print (step + i)
    global_step.assign(step + i).eval()
    saver.save(sess, os.getcwd() + "/global_step2.ckpt")



0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0