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

Better API #2

Closed
Kaixhin opened this issue Nov 19, 2015 · 3 comments
Closed

Better API #2

Kaixhin opened this issue Nov 19, 2015 · 3 comments

Comments

@Kaixhin
Copy link
Owner

Kaixhin commented Nov 19, 2015

Currently nninit is a bit clunky (in an effort to avoid side-effects). I would like to modify nn.Module to have something like an init method, with an API along the lines of:

nn.Linear(4096, 1000):init('weight', 'xavier', 'normal'):init('weight', 'sparse', 0.3):init('bias', 'constant', 0)

I think returning the module and therefore being able to chain calls makes it a lot more elegant. The current way of entering parameters can also be discussed. Any thoughts @soumith / @skaae?

@Kaixhin Kaixhin mentioned this issue Nov 19, 2015
@Kaixhin
Copy link
Owner Author

Kaixhin commented Nov 19, 2015

New API ready for review at https://github.com/Kaixhin/nninit/tree/chaining.

Edit: Now on master.

@soumith
Copy link

soumith commented Nov 20, 2015

ooooh, i like the :init style.

@Kaixhin Kaixhin mentioned this issue Nov 20, 2015
@Kaixhin
Copy link
Owner Author

Kaixhin commented Nov 20, 2015

Glad to hear it. My 2 main questions at this point are:

  • Is adding the init method to nn.Module relatively safe at this point?
  • Using the 'wb' flag for 'constant', 'normal' and 'uniform' is slightly clunky; any alternatives? Having winit for weights and binit for biases?

Edit: Now using wInit and bInit to enforce separation between the two. Please comment if you think this needs reviewing.

@Kaixhin Kaixhin closed this as completed Nov 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants