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

RFC: SameDiff op class creator class heirarchy #7144

Closed
AlexDBlack opened this issue Feb 11, 2019 · 1 comment
Closed

RFC: SameDiff op class creator class heirarchy #7144

AlexDBlack opened this issue Feb 11, 2019 · 1 comment
Labels
SameDiff Autodiff related issues

Comments

@AlexDBlack
Copy link
Contributor

Something I've been considering doing recently is reorganizing the SameDiff class more along the lines of TF and PyTorch.
Currently all of the "op creator" methods are defined on the SameDiff class itself:
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java

Instead, we would have something like:

SameDiff sd = SameDiff.create();
...
SDVariable relu = sd.nn.relu(...);                //Currently: sd.relu(...)
SDVariable count = sd.math.countNonZero(...);     //Currently: sd.countNonZero(...)

The motivation is three-fold:
(a) In theory it should be easier for users to find relevant ops
(b) Ease of documentation (autogen docs by section)
(c) Maintenance - a lot of the op methods could be moved to other classes, making SameDiff.java more managable (it's 11,500 lines so far)

As for categories, here's a start:

  • nn (neural network)
  • math
  • loss
  • random
  • image? (We do have stuff like resizeBilinear)
  • linalg?

Some open questions:

  • What should be on the "main" SameDiff namespace vs. the sub-categories?
  • Should we have more than 1 level? Or allow things like sd.nn.rnn.LSTM(...)?
  • Should there be similar organization for SDVariable methods?
  • What categories should we use?

If this change is to be implemented, it should happen before the next release (and sooner if possible).

@lock
Copy link

lock bot commented Mar 20, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
SameDiff Autodiff related issues
Projects
None yet
Development

No branches or pull requests

1 participant