aesara icon indicating copy to clipboard operation
aesara copied to clipboard

The naming of the division `Op`s is inconsistent with NumPy's

Open rlouf opened this issue 3 years ago • 3 comments

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

  • [x] s/at.true_div/at.true_divide
  • [x] s/at.floor_div/at.floor_divide
  • [x] Deprecate the alias at.int_div
  • [x] 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 avatar Sep 26 '22 09:09 rlouf

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

sudarsan2k5 avatar Feb 07 '23 19:02 sudarsan2k5

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 avatar Feb 07 '23 22:02 rlouf

We should open issues for the remaining items.

rlouf avatar Feb 13 '23 20:02 rlouf