aesara-devs / aesara

Aesara is a Python library for defining, optimizing, and efficiently evaluating mathematical expressions involving multi-dimensional arrays.
https://aesara.readthedocs.io
Other
1.18k stars 153 forks source link

Rename `floor_div` to `floor_divide` to match NumPy's API #1432

Closed sudarsan2k5 closed 1 year ago

sudarsan2k5 commented 1 year ago

Addressing #1212

codecov[bot] commented 1 year ago

Codecov Report

Merging #1432 (711b8c6) into main (c433071) will decrease coverage by 0.01%. The diff coverage is 87.50%.

Additional details and impacted files [![Impacted file tree graph](https://codecov.io/gh/aesara-devs/aesara/pull/1432/graphs/tree.svg?width=650&height=150&src=pr&token=2HNzVWyxrA&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aesara-devs)](https://codecov.io/gh/aesara-devs/aesara/pull/1432?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aesara-devs) ```diff @@ Coverage Diff @@ ## main #1432 +/- ## ========================================== - Coverage 74.86% 74.86% -0.01% ========================================== Files 194 194 Lines 50107 50105 -2 Branches 12098 12098 ========================================== - Hits 37514 37512 -2 Misses 10266 10266 Partials 2327 2327 ``` | [Impacted Files](https://codecov.io/gh/aesara-devs/aesara/pull/1432?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aesara-devs) | Coverage Δ | | |---|---|---| | [aesara/compile/profiling.py](https://codecov.io/gh/aesara-devs/aesara/pull/1432?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aesara-devs#diff-YWVzYXJhL2NvbXBpbGUvcHJvZmlsaW5nLnB5) | `74.55% <ø> (ø)` | | | [aesara/tensor/basic.py](https://codecov.io/gh/aesara-devs/aesara/pull/1432?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aesara-devs#diff-YWVzYXJhL3RlbnNvci9iYXNpYy5weQ==) | `89.99% <ø> (ø)` | | | [aesara/tensor/elemwise.py](https://codecov.io/gh/aesara-devs/aesara/pull/1432?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aesara-devs#diff-YWVzYXJhL3RlbnNvci9lbGVtd2lzZS5weQ==) | `88.07% <ø> (ø)` | | | [aesara/tensor/var.py](https://codecov.io/gh/aesara-devs/aesara/pull/1432?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aesara-devs#diff-YWVzYXJhL3RlbnNvci92YXIucHk=) | `87.82% <50.00%> (ø)` | | | [aesara/tensor/rewriting/math.py](https://codecov.io/gh/aesara-devs/aesara/pull/1432?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aesara-devs#diff-YWVzYXJhL3RlbnNvci9yZXdyaXRpbmcvbWF0aC5weQ==) | `86.11% <60.00%> (ø)` | | | [aesara/link/jax/dispatch/scalar.py](https://codecov.io/gh/aesara-devs/aesara/pull/1432?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aesara-devs#diff-YWVzYXJhL2xpbmsvamF4L2Rpc3BhdGNoL3NjYWxhci5weQ==) | `96.72% <100.00%> (ø)` | | | [aesara/link/numba/dispatch/elemwise.py](https://codecov.io/gh/aesara-devs/aesara/pull/1432?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aesara-devs#diff-YWVzYXJhL2xpbmsvbnVtYmEvZGlzcGF0Y2gvZWxlbXdpc2UucHk=) | `97.12% <100.00%> (ø)` | | | [aesara/scalar/basic.py](https://codecov.io/gh/aesara-devs/aesara/pull/1432?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aesara-devs#diff-YWVzYXJhL3NjYWxhci9iYXNpYy5weQ==) | `79.17% <100.00%> (-0.01%)` | :arrow_down: | | [aesara/tensor/inplace.py](https://codecov.io/gh/aesara-devs/aesara/pull/1432?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aesara-devs#diff-YWVzYXJhL3RlbnNvci9pbnBsYWNlLnB5) | `100.00% <100.00%> (ø)` | | | [aesara/tensor/math.py](https://codecov.io/gh/aesara-devs/aesara/pull/1432?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aesara-devs#diff-YWVzYXJhL3RlbnNvci9tYXRoLnB5) | `90.67% <100.00%> (-0.01%)` | :arrow_down: |
sudarsan2k5 commented 1 year ago

I believe there is still some int_div that I need to replace with floor_div and have to add the test for deprecation warning so converting this to draft.

sudarsan2k5 commented 1 year ago

Hi @brandonwillard,

I made the below changes

  1. replaced floor_div with floor_divide
  2. added an alias int_div to floor_divide
  3. removed some int_div imports and used floor_divide inplace of it
  4. changed some function names and docs to maintain consistency across the code base
  5. renamed true_div_inplace to true_divide_inplace for consistency
  6. added tests for the deprecation of int_div and floor_div
sudarsan2k5 commented 1 year ago

image

Thank you, Now this is working fine

sudarsan2k5 commented 1 year ago

Hi @rlouf I have renamed floor_div for floor_divide, added related tests and also renamed to related class name, could you please check if this PR is ready to merge or anything else is still pending? Thanks

rlouf commented 1 year ago

Looks good to me. Thank you for contributing @sudarsan2k5, NumPy compatibility is very important.