Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions 28 dpctl/tensor/_elementwise_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,20 @@ def get_type_result_resolver_function(self):
"""
return self.result_type_resolver_fn_

@property
def nin(self):
"""
Returns the number of arguments treated as inputs.
"""
return 1

@property
def nout(self):
"""
Returns the number of arguments treated as outputs.
"""
return 1

@property
def types(self):
"""Returns information about types supported by
Expand Down Expand Up @@ -531,6 +545,20 @@ def get_type_promotion_path_acceptance_function(self):
"""
return self.acceptance_fn_

@property
def nin(self):
"""
Returns the number of arguments treated as inputs.
"""
return 2

@property
def nout(self):
"""
Returns the number of arguments treated as outputs.
"""
return 1

@property
def types(self):
"""Returns information about types supported by
Expand Down
24 changes: 24 additions & 0 deletions 24 dpctl/tests/elementwise/test_elementwise_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,27 @@ def test_binary_class_str_repr():
kl_n = binary_fn.__name__
assert kl_n in s
assert kl_n in r


def test_unary_class_nin():
nin = unary_fn.nin
assert isinstance(nin, int)
assert nin == 1


def test_binary_class_nin():
nin = binary_fn.nin
assert isinstance(nin, int)
assert nin == 2


def test_unary_class_nout():
nout = unary_fn.nout
assert isinstance(nout, int)
assert nout == 1


def test_binary_class_nout():
nout = binary_fn.nout
assert isinstance(nout, int)
assert nout == 1
Morty Proxy This is a proxified and sanitized view of the page, visit original site.