Git Product home page Git Product logo

Comments (7)

eiderman avatar eiderman commented on May 7, 2024 1

In the latest version that I try, I don't get that error. I can reproduce it if I put everything in a namescope and call it twice.

This is a limitation of how name_scopes and variable_scopes work together and is is recommended to prefer variable_scope when you are creating sub-graphs with variables (which all the layers do).

If you are using an interactive shell like jupyter, I find using an explicit graph when playing around (e.g. with tf.Graph().as_default():) really helps cut down on interference type errors.

from prettytensor.

fftobiwan avatar fftobiwan commented on May 7, 2024

I think the problem was that the variable scope was not set properly in scopes.var_and_name_scope().

I applied the following change to get everything working:

diff --git a/prettytensor/scopes.py b/prettytensor/scopes.py
index 809b32a..d1a914e 100644
--- a/prettytensor/scopes.py
+++ b/prettytensor/scopes.py
@@ -69,7 +69,8 @@ def var_and_name_scope(names):
               initializer=old_vs.initializer)

         vs_key[0].name_scope = scope
-        yield scope, vs_key[0]
+        with tf.variable_scope(vs_key[0]):
+          yield scope, vs_key[0]
       finally:
         vs_key[0] = old_vs

Now the variables have properly scoped names like "fully_connected/weights" instead of just "weights".

I am using TensorFlow 0.7.1

from prettytensor.

Wakeupbuddy avatar Wakeupbuddy commented on May 7, 2024

I had the same error when I rebase to 0.8.0. @fftobiwan 's fix also works for me.

from prettytensor.

eiderman avatar eiderman commented on May 7, 2024

Thanks for the update. It appears that a certain change has landed, so I will upload with the fix.

from prettytensor.

eiderman avatar eiderman commented on May 7, 2024

I've made the update -- this was related to changes in the semantics of tf.get_collection() and tf.get_collection_ref().

Please verify that it works, thanks again!

from prettytensor.

fftobiwan avatar fftobiwan commented on May 7, 2024

It works for me, thank you very much.

from prettytensor.

ggardu avatar ggardu commented on May 7, 2024

Zoe from stackOverflow said:
tf.reset_default_graph()
at the beginning of the script.
Worked for me. Thanks,

from prettytensor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.