tf referred to before initialized in nn.py
Hi,
Expected behavior
I'm trying to program with the various objects. At one point I call Merger.main, which I expect to succeed.
Actual behavior
I get the exception
*** NameError: name 'tf' is not defined
Steps to reproduce
My code had previously called several things. It's a little painful to describe, and I think I know what the problem is and how to fix it, so see below.
Other relevant information
Calling Merger.main causes nn.initialize to be called. Apparently it had previously been called. So in core/leras/nn.py, at line 47, nn.tf is not None, so the code block from line 48 to 115 is skipped. In particular, the local variable tf has not been set. So when line 118 is executed (nn.tf_sess = tf.Session(config=nn.tf_sess_config) the exception shown above is thrown.
Shouldn't that line be nn.tf_sess = nn.tf.Session(config=nn.tf_sess_config, i.e., shouldn't tf.Session be nn.tf.Session?
Did you ever find the answer? If so, would you mind sharing it and closing this issue?
No, I have heard nothing. In my original post I described why the problem occurs and my opinion of what should be done to fix it: At line 118 (in that version) of core/leras/nn.py, on the right-hand-side tf.Session should be changed to nn.tf.Session. It works for me.