Hi, Why do you want to subclass SharedVariable to implement Adam? Many people have implement Adam without subclassing SharedVariable.
Normally, why we create a new subclass of SharedVariable is when we create a new Variable subclass. This is when we want to represent a new object in the graph, like a sparse object, an object on the gpu, python list, python dict (not done, but would request a new Variable subclass). Frédéric On Thu, Sep 8, 2016 at 10:36 AM, fstab <[email protected]> wrote: > Hi, > > in order to implement Adam gradient descent I wanted to subclass > SharedVariable. > > Reading the documentation available at location [1] was quite confusing > and I am let with many questions, and I will be grateful for any > elucidations: > > 1. the user friendly constructor shared(). Why is it called a > "constructor"? A constructor [2] is like an instance method and should be > inside a class. This does not look like an instance method. This looks like > a static *factory method* [3] and it should be called as such. > 2. about shared(), the documentation says: "This function iterates over > constructor functions to find a suitable SharedVariable subclass", this > sentence is very cryptic and let me confused but then I read the > documentation of shared_constructor and it explains what it seems to be a > register of "constructors". > 3. why is shared_constructor not called register_shared_constructor, or > better register_shared_factory_function? Naming is important and that > name suggests that shared_constructor is a constructor/factory but it's > not, it's purpose is to add constructors/factories to a register. > 4. "If you want to use a specific shared variable constructor, consider > calling it directly." Again, confusion. Is this suggesting to trigger the > constructor __init__ by direct instantiation or to create a > constructor/factory function myself and call it, or is it suggesting that > if I add a constructor/factory to the register, then this will be available > in theano.compile.sharedvalue's namespace? (and even this latter case does > not seem to be how it works because the "register" shared_constructor does > not let to specify the name of the constructor). > > Thank you in advance for your clarifications and I am sorry this post > sounds like a rant, but I got frustrated and I think that describing my > difficulties reading the documentation might be helpful for you to improve > it. > > [1] http://deeplearning.net/software/theano/library/compile/shared.html > [2] https://en.wikipedia.org/wiki/Constructor_(object-oriented_ > programming) > [3] https://en.wikipedia.org/wiki/Factory_method_pattern > > -fstab > > -- > > --- > You received this message because you are subscribed to the Google Groups > "theano-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- --- You received this message because you are subscribed to the Google Groups "theano-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
