Coder Social home page Coder Social logo

Comments (3)

Hvass-Labs avatar Hvass-Labs commented on June 25, 2024

I have made a temporary fix but it is really ugly. The following is added to the above code:

scaler = tf.Variable(initial_value=0.001)
self.q_values = scaler * self.q_values
self.q_values = pt.wrap(self.q_values)

Surely there must be a Pretty way of scaling the initial weights of the layers?

from prettytensor.

eiderman avatar eiderman commented on June 25, 2024

I see that while the documentation mentions that weights can take an initializer function, it doesn't specify that it is a standard tensorflow initializer (e.g. tf.constant_initializer, tf.random_uniform_initializer, etc.). Basically it is any function that has the signature: init(shape, dtype=tf.float32, partition_info=None). They are listed here (towards the bottom and not in any particular order): https://www.tensorflow.org/api_docs/python/state_ops/sharing_variables

with pt.defaults_scope(activation_fn=tf.nn.relu):
    self.q_values = x_pretty.\
        conv2d(kernel=8, depth=16, stride=4, name='layer_conv1').\
        conv2d(kernel=4, depth=32, stride=2, name='layer_conv2').\
        flatten().\
        fully_connected(size=256, name='layer_fc1').\
        fully_connected(size=num_actions, name='layer_fc2', activation_fn=None, 
                                  weights=tf.random_uniform_initializer(0.001))

from prettytensor.

Hvass-Labs avatar Hvass-Labs commented on June 25, 2024

Thanks. I think I got a little confused because I found the PrettyTensor initializers which need a shape parameter, which I obviously cannot provide. But tf.random_normal_initializer() and tf.truncated_normal_initializer() work fine. It might be a good idea to mention this in the docs.

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.