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

The naming of the division Ops is inconsistent with NumPy's #1212

Open
4 of 6 tasks
Tracked by #1424
rlouf opened this issue Sep 26, 2022 · 3 comments · Fixed by #1414
Open
4 of 6 tasks
Tracked by #1424

The naming of the division Ops is inconsistent with NumPy's #1212

rlouf opened this issue Sep 26, 2022 · 3 comments · Fixed by #1414
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed NumPy compatibility refactor This issue involves refactoring

Comments

@rlouf
Copy link
Member

rlouf commented Sep 26, 2022

Numpy provides the following API to perform division element-wise:

import numpy as np

np.true_divide
np.divide   # alias to `numpy.true_divide`
np.floor_divide

While Aesara uses the following names:

import aesara.tensor as at

at.true_div
at.floor_div
at.int_div   # an alias for `floor_div`

My suggestion is thus

  • s/at.true_div/at.true_divide
  • s/at.floor_div/at.floor_divide
  • Deprecate the alias at.int_div
  • Add an alias at.divide to at.true_divide

And while we're at it:

  • Rename at.mod to at.remainder and set at.mod as an alias to at.remainder (like NumPy)
  • Add at.fmod

As an aside the documentation does not reference the API that is currently implemented, it stills references truediv, intdiv and floordiv instead of respectively true_div, int_div and floor_div.

@rlouf rlouf added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed refactor This issue involves refactoring NumPy compatibility labels Sep 26, 2022
@sudarsan2k5
Copy link
Contributor

should we keep treu_div and create one more true_divide instance, or should we completely replace true_div with true_divide?

@rlouf
Copy link
Member Author

rlouf commented Feb 7, 2023

Since some code probably relies on true_div we should:

(1) Replace true_div with true_divide throughout the codebase
(2) Create a true_div alias
(3) Add a deprecation warning for those trying to use said alias.

@rlouf
Copy link
Member Author

rlouf commented Feb 13, 2023

We should open issues for the remaining items.

@rlouf rlouf reopened this Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed NumPy compatibility refactor This issue involves refactoring
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants