Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enrich function doc for getParameters() #966

Closed
zhichao-li opened this issue Jun 5, 2017 · 1 comment · Fixed by #2262
Closed

Enrich function doc for getParameters() #966

zhichao-li opened this issue Jun 5, 2017 · 1 comment · Fixed by #2262

Comments

@zhichao-li
Copy link
Contributor

zhichao-li commented Jun 5, 2017

  1. Add final to getParameters() to prevent overriding in subclass
  2. We might need to add a checking to ensure not invoking this method multiple times but alert that in comments maybe enough as it would slightly effect the performance.
  3. Enrich the comments with:

This function returns two tensors. One for the flattened learnable parameters flatParameters and another for the gradients of the energy wrt to the learnable parameters flatGradParameters.

Custom modules should not override this function. They should instead override parameters(...) which is, in turn, called by the present function.

This function will go over all the weights and gradWeights and make them view into a single tensor (one for weights and one for gradWeights). Since the storage of every weight and gradWeight is changed, this function should be called only once on a given network.

@yiheng
Copy link
Contributor

yiheng commented Jun 8, 2017

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants