singa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [singa] nudles opened a new issue #693: Extend the Module class
Date Sat, 09 May 2020 10:03:45 GMT

nudles opened a new issue #693:

   In  #674 , we propose to move the param creation and initialization into the forward propagation
stage, i.e., `__call__`. 
   However, sometimes, we may want to access the parameters of a model after it is created,
   m = ModelFoo()
   m.get_params()  # returns the params of each layer via get_params
   We will get errors since the params are not created yet.
   To resolve this issue, we can add a new method to the Module class
   def init(self, x):
       # x represents the input tensor(s) whose values could be randomly filled, 
       # but the shape and device are set correctly.
       self.forward(x)  # the forward propagation will initialize all params.
   The following code will pass without errors.
   m = ModelFoo()
   m.get_params()  # returns the params of each layer via get_params

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:

View raw message