I have trouble with some Python-Code I'm currently working at. I trained a tensorflow model and now I'm trying to use it. Therefore I made a little Tkinter-GUI, that should perform a feedforward run with a random vector as input everytime I press a button. The first few attempts, it always works, but after a few runs, I'm getting a SIGSEGV-error: "Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)" Does anyone have an idea what could cause that problem? I suspect it has something to do how Tkinter handles it's function-callbacks

Here are the relevant lines of my code:

In my GUI-initialisation I load my Tensorflow-Model:

tf.reset_default_graph()
saver = tf.train.import_meta_graph('./train/infer/infer.meta')
graph = tf.get_default_graph()
self.sess = tf.InteractiveSession()
saver.restore(self.sess, 'model.ckpt-93624')
initialize_tf_model()
self.z = graph.get_tensor_by_name('z:0')
self.G_z = graph.get_tensor_by_name('G_z:0')

And afterwards I'm initializing my button with a function as command:

self.slogan2 = Button(frame,
                         text="Test",
                         command=self.foo_function)
    self.slogan2.pack(side=LEFT)

And here my foo_function that performs a feedforward-run:

def foo_function(self):
    _z = (np.random.rand(1, 100) * 2.) - 1
    _G_z = self.sess.run(self.G_z, {self.z: _z})

Has anyone an idea what I might be doing wrong?

Thank you a lot!

0 Answers