Skip to content

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

Merged
merged 12 commits into from
Jun 20, 2021
Merged

support parameter out for matmul func #722

merged 12 commits into from
Jun 20, 2021

Conversation

KsanaKozlova
Copy link
Contributor

No description provided.

@KsanaKozlova KsanaKozlova requested a review from densmirn May 24, 2021 10:55
Comment on lines 242 to 248
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

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.

Comment on lines 243 to 246
if out.dtype != result_type:
raise TypeError("Inappropriate type of ``out`` variable")
elif out.shape != shape_result:
raise ValueError("Inappropriate shape of ``out`` variable")
Copy link
Contributor

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)

Copy link
Contributor

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.

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.

Copy link
Contributor

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.

Copy link

@samir-nasibli samir-nasibli left a 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.

Comment on lines +243 to +246
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)

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.

@densmirn densmirn requested a review from shssf May 25, 2021 14:49
@shssf shssf merged commit de49888 into master Jun 20, 2021
@shssf shssf deleted the add_out_to_matmul_func branch June 20, 2021 18:28
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.

4 participants