Skip to content

Cleans up elementwise function docstrings #1559

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

Merged
merged 16 commits into from
Feb 22, 2024

Conversation

ndgrigorian
Copy link
Collaborator

This pull request makes a number of changes to the docstrings of element-wise functions, with a focus on guaranteeing that the information in the docstrings is correct and removing typos.

Each function, when referencing expected data types of inputs, now refers to the types which will not be cast. For example, dpt.divide arguments now state that they expect floating-point data, as otherwise, the data will be copied and cast.

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • If this PR is a work in progress, are you opening the PR as a draft?

- abs input does not need to be numeric, as booleans are accepted
- Add can take `bool` inputs, not just numeric.
…unctions

- proj expects complex inputs and does not always return the same data type as the original input
- conj expects numeric inputs and does not return booleans
- real, imag take any data type
- Round now notes that ties are rounded to the nearest even integer and no longer claims to always return the same data type
- Floor does not always return the same data type
- Ceil does not always return the same data type
- comparison functions expect any data type
- divide expects floating-point data types
- log1p, logaddexp, and expm1 docstrings are now more descriptive
- input types corrected in all cases
- input types corrected
- 'check' changed to 'test'
Copy link

github-actions bot commented Feb 22, 2024

Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞

@coveralls
Copy link
Collaborator

Coverage Status

coverage: 91.148%. remained the same
when pulling 7ef1ccc on clean-up-elementwise-fn-docs
into 7ab3731 on master.

Copy link

Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_33 ran successfully.
Passed: 907
Failed: 0
Skipped: 88

@@ -954,10 +964,12 @@
# U20: ==== LOG (x)
_log_docstring = """
log(x, out=None, order='K')
Computes the natural logarithm element-wise.

Computes the natural logarithm for each element `x_i` of input array `x`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we used "Test if each element ..." above, we should be consistent and use "Compute the natural logarithm ...".

No need to change it in this PR, but we should make a note of this and apply changes eventually.

Copy link
Contributor

@oleksandr-pavlyk oleksandr-pavlyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling these changes @ndgrigorian

This PR is good to go in.

@ndgrigorian ndgrigorian merged commit a42d5a4 into master Feb 22, 2024
@ndgrigorian ndgrigorian deleted the clean-up-elementwise-fn-docs branch February 29, 2024 19:02
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

Successfully merging this pull request may close these issues.

3 participants