Git Product home page Git Product logo

Comments (4)

awjuliani avatar awjuliani commented on September 26, 2024

Hi Ibrahim,

I am unsure of what you mean by the shared network being counted twice. If you are using A3C with one worker, then there should be two network initialized, one global network and one worker network.

from deeprl-agents.

IbrahimSobh avatar IbrahimSobh commented on September 26, 2024

Hi Arthur

I want to know exactly the number of trainable parameters ... I used this code

total_parameters = 0
for variable in tf.trainable_variables():
    shape = variable.get_shape()
    print(shape)
    variable_parametes = 1
    for dim in shape:
        variable_parametes *= dim.value
    total_parameters += variable_parametes
print(total_parameters)

and got this result above where this part is repeated twice:

(8, 8, 1, 16)
(16,)
(4, 4, 16, 32)
(32,)

My question is, how many trainable parameters are there in A3C code?

Thank you

from deeprl-agents.

awjuliani avatar awjuliani commented on September 26, 2024

The answer above accurately describes the total number of trainable parameters. But you need to keep into account that it is doubled the number of parameters actually ever being updated (or used for value and policy calculation).

from deeprl-agents.

IbrahimSobh avatar IbrahimSobh commented on September 26, 2024

Thanks @awjuliani

Could you please comment on this elaboration to ensure correct understanding?

I understand that the following:
1- each worker get a copy of the global network
2- each worker interacts with its environment and calculates loss and gradients
3- each worker updates the global network using gradients (not its local network)
4- go to step 1

So, if we have only one worker, we will have 2 identical networks:
1- global (where actual parameters updates take place)
2- local (worker) where environment interactions, loss and gradients are calculated (no parameter update for local networks)

This is why number of parameters increases when number of workers increases (because each worker has local copy of the network)

And the actual number of parameters that are actually updates is 2398816 / 2 (Number of parameters when using one worker divided by 2)

I hope this is correct

Finally, I would like to thank you for your excellent article

from deeprl-agents.

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.