tensorflow-- Save Load Model

s=mnist.train.next_batch(batch_size)
print(xs.shape)
print(ys.shape)

## taken from the set of all the variables
# tf.get_collection ()
within the element corresponding to the list adding ##
# tf.add_n ([])
# # conversion type
# tf.cast (X, DTYPE =)
## where the maximum value of return good sequence
# tf.argmax (X, Axis)
# # add paths
# Import OS
# the os.path.join ( "Home", "name")
# # string manipulation Split ()
# "./model/momist_model- 1001 ".split (" / ") [- 1] .split (" - ") [- 1]

# # Saved model
# tf.train.Saver Saver = ()
# with tf.Session () AS Sess:
# for I in Range (Steps):
#% rounds IF I 0 ==:
# saver.save (Sess, os.path.join (the mODEL, NAME), global_step, Ltd. Free Join =)
# # load model

With tf.Session # () AS Sess:
# = tf.train.get_checkpoint_state CKPT (storage path)
# IF CKPT andckpt.model_path:
# saver.restore (Sess, ckpt.model_path)


# # instantiated reducing sliding Pingjun
# EMA = tf.train.ExponentialMovingAverage (moving average basis)
# = ema_restore ema.variable_to_restore ()
# = tf.train.Saver Saver (ema_restore)


# # Calculation accuracy
# correct_prediction = tf.equal (tf.argmax (Y,. 1), tf.argmax (Y_,. 1))
# = accurcy tf.reduce_mean (tf.cast (correct_prediction, tf.float32))

Guess you like

Origin www.cnblogs.com/shuimuqingyang/p/11022644.html