Skip to content

Only save once? #34

Description

@WardBeullens

It seems that after saving a model, all subsequent saves are identical.

I made a minimal example that reproduces the problem:

import tensorflow as tf
import tfdeploy.tfdeploy as td

def pickleModel(sess,out,file_name):
    model = td.Model()
    model.add(out,sess)
    model.save(file_name)

def unpickleModel(file_name):
    model = td.Model(file_name)
    out = model.get('output')
    print("td evaluation = ",out.eval())

if __name__ == '__main__':

    counter = tf.Variable(  0.0  , name='counter' )
    out = tf.multiply(counter,1,name ='output')
    increment = tf.assign(counter,counter+1)

    sess = tf.Session()
    sess.run(tf.global_variables_initializer())

    pickleModel(sess,out,'file1')
    print('tensorflow evaluation = ',sess.run(out))
    unpickleModel('file1')

    sess.run(increment)

    pickleModel(sess,out,'file2')
    print('tensorflow evaluation = ',sess.run(out))
    unpickleModel('file2')

The ouput is :
tensorflow evaluation = 0.0
td evaluation = 0.0
tensorflow evaluation = 1.0
td evaluation = 0.0

But the last td evaluation should be equal to 1.0. What is going on?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions