Commit 1709be99 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

marked rv_stage1_out as not trainable - smaller model size

parent 5bc70b70
...@@ -138,6 +138,7 @@ Probably ResourceVariable is not needed here because of the tf.scatter_update() ...@@ -138,6 +138,7 @@ Probably ResourceVariable is not needed here because of the tf.scatter_update()
If collection is not provided, it defaults to [GraphKeys.GLOBAL_VARIABLES], and that in turn fails saver.restore() as this variable was not available in the trained model If collection is not provided, it defaults to [GraphKeys.GLOBAL_VARIABLES], and that in turn fails saver.restore() as this variable was not available in the trained model
""" """
'''
#rv_stage1_out = resource_variable_ops.ResourceVariable( #rv_stage1_out = resource_variable_ops.ResourceVariable(
rv_stage1_out = tf.Variable( rv_stage1_out = tf.Variable(
np.zeros([HEIGHT * WIDTH, NN_LAYOUT1[-1]]), np.zeros([HEIGHT * WIDTH, NN_LAYOUT1[-1]]),
...@@ -145,14 +146,14 @@ rv_stage1_out = tf.Variable( ...@@ -145,14 +146,14 @@ rv_stage1_out = tf.Variable(
collections = [GraphKeys.LOCAL_VARIABLES],# Works, available with tf.local_variables() collections = [GraphKeys.LOCAL_VARIABLES],# Works, available with tf.local_variables()
dtype=np.float32, dtype=np.float32,
name = 'rv_stage1_out') name = 'rv_stage1_out')
''' '''
rv_stage1_out = tf.get_variable("rv_stage1_out", rv_stage1_out = tf.get_variable("rv_stage1_out",
shape=[HEIGHT * WIDTH, NN_LAYOUT1[-1]], shape=[HEIGHT * WIDTH, NN_LAYOUT1[-1]],
dtype=tf.float32, dtype=tf.float32,
initializer=tf.zeros_initializer, initializer=tf.zeros_initializer,
collections = [GraphKeys.LOCAL_VARIABLES],trainable=False) collections = [GraphKeys.LOCAL_VARIABLES],trainable=False)
'''
#rv_stageX_out_init_placeholder = tf.placeholder(tf.float32, shape=[HEIGHT * WIDTH, NN_LAYOUT1[-1]]) #rv_stageX_out_init_placeholder = tf.placeholder(tf.float32, shape=[HEIGHT * WIDTH, NN_LAYOUT1[-1]])
#rv_stageX_out_init_op = rv_stageX_out.assign(rv_stageX_out_init_placeholder) #rv_stageX_out_init_op = rv_stageX_out.assign(rv_stageX_out_init_placeholder)
...@@ -273,6 +274,10 @@ with tf.Session() as sess: ...@@ -273,6 +274,10 @@ with tf.Session() as sess:
that do not have this variable, add it to globals. that do not have this variable, add it to globals.
Actually it could have been declared right here - this Actually it could have been declared right here - this
needs testing. needs testing.
NOTE: The line below makes the next script's, that saves
a Saved_Model MetaGraph, size of the Saved_Model significantly
bigger.
''' '''
tf.add_to_collection(GraphKeys.GLOBAL_VARIABLES, rv_stage1_out) tf.add_to_collection(GraphKeys.GLOBAL_VARIABLES, rv_stage1_out)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment