-
Notifications
You must be signed in to change notification settings - Fork 23
support parameter out for matmul func #722
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
Conversation
dpnp/dpnp_algo/dpnp_algo.pyx
Outdated
if out is not None: | ||
if out.dtype != result_type: | ||
raise TypeError("Inappropriate type of ``out`` variable") | ||
elif out.shape != shape_result: | ||
raise ValueError("Inappropriate shape of ``out`` variable") | ||
else: | ||
result = out |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not raise error here.
It is better move this on python level and make this as fallback condition.
dpnp/dpnp_algo/dpnp_algo.pyx
Outdated
if out.dtype != result_type: | ||
raise TypeError("Inappropriate type of ``out`` variable") | ||
elif out.shape != shape_result: | ||
raise ValueError("Inappropriate shape of ``out`` variable") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use checker_throw_value_error
in these cases, e.g.:
checker_throw_value_error('matmul', 'out.dtype', out.dtype, result_type)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could replace elif
with if
and remove line with else
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No error raising on cython layer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't know result_type
in python level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, avoid using quoted comments, use #
sign for them.
if out.dtype != result_type: | ||
checker_throw_value_error('matmul', 'out.dtype', out.dtype, result_type) | ||
if out.shape != shape_result: | ||
checker_throw_value_error('matmul', 'out.shape', out.shape, shape_result) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will not work. Avoid using this kind of error throwing. It is better avoiding error raising in cython level. redesign is needed.
No description provided.