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

Update docs for Universal Functions #1863

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Update docs for Universal Functions #1863

wants to merge 3 commits into from

Conversation

npolina4
Copy link
Collaborator

Added new class for Universal Functions with full documentation that united unary and binary element-wise functions.
Updated dpnp.add and dpnp.abs functions for prototype for future element-wise functions.

All element-wise functions will be updated according to this prototype in the next PR.

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to 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 filing the PR as a draft?

@npolina4 npolina4 requested a review from antonwolfy May 31, 2024 18:40
Copy link
Contributor

View rendered docs @ https://intelpython.github.io/dpnp/pull/1863/index.html

@@ -98,6 +98,7 @@ repos:
"-sn", # Don't display the score
"--disable=import-error",
"--disable=redefined-builtin",
"--disable=unused-wildcard-import"
"--disable=unused-wildcard-import",
"--class-naming-style=snake_case"
Copy link
Contributor

Choose a reason for hiding this comment

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

it would be better to update pyproject.toml:

[tool.pylint.basic]
include-naming-hint = true
class-naming-style = "snake_case"

dpnp/dpnp_algo/dpnp_elementwise_common.py Outdated Show resolved Hide resolved
self.nin_ = nin
_name = "_" + name

dpt_result_type = getattr(ti, _name + "_result_type")
Copy link
Contributor

Choose a reason for hiding this comment

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

How will it be propose to handle elementwise functions which are not present in dcptl? (like fabs which we will need to implement separately in dpnp)

dpnp/dpnp_algo/dpnp_elementwise_common.py Outdated Show resolved Hide resolved
dpnp/dpnp_algo/dpnp_elementwise_common.py Outdated Show resolved Hide resolved
doc/reference/ufunc.rst Outdated Show resolved Hide resolved
dpnp/dpnp_iface_mathematical.py Outdated Show resolved Hide resolved
return dpnp_array._create_from_usm_ndarray(res_usm)

@property
def nin(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

We will need to add some tests to verify the attributes. Also to enable some relating third party tests.

Comment on lines 8 to +9
DPNP provides universal functions (a.k.a. ufuncs) to support various element-wise operations.
DPNP ufunc supports following features of NumPy’s one:
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be better to reuse numpy like description here with a reference to numpy documentation at the end.


Parameters
----------
*x : {dpnp.ndarray, usm_ndarray}
Copy link
Contributor

Choose a reason for hiding this comment

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

the autogenerated page is not properly describes arguments, like

param *x : Input arrays.
type *x : {dpnp.ndarray, usm_ndarray}

while expected a list under Parameters:

Parameters: *x ({dpnp.ndarray, usm_ndarray}) -- ....

i.e. the style of description is different

ufunc()

Functions that operate element by element on whole arrays.

Copy link
Contributor

Choose a reason for hiding this comment

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

missing a link to numpy.ufunc

Keyword arguments `where` and `subok` are supported with their default values.
Other keyword arguments is currently unsupported.
Otherwise ``NotImplementedError`` exception will be raised.

Copy link
Contributor

Choose a reason for hiding this comment

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

what is about the Attributes section?

Other keyword arguments is currently unsupported.
Otherwise ``NotImplementedError`` exception will be raised.

"""
Copy link
Contributor

Choose a reason for hiding this comment

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

due to some reason the whole description of dpnp.ufunc.outer was inserted to dpnp.ufunc page, but expected to have only summary per each method, like here

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.

2 participants