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

add backward of conv2d #365

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Conversation

FatJhon
Copy link
Collaborator

@FatJhon FatJhon commented Dec 16, 2024

add backwards of input weight bias for conv.

Copy link
Collaborator

@Galaxy1458 Galaxy1458 left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution. Could you provide performance data for our comparative analysis?

Copy link
Collaborator

@StrongSpoon StrongSpoon left a comment

Choose a reason for hiding this comment

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

there is error in benchmark. please solve it.

tests/test_reduction_ops.py Outdated Show resolved Hide resolved
src/flag_gems/ops/conv2d.py Show resolved Hide resolved
if stride_height > 1 or stride_width > 1:
for i in range(out_grad.shape[2]):
for j in range(out_grad.shape[3]):
new_out[:, :, i * (stride_height), j * (stride_width)] = out_grad[
Copy link
Collaborator

Choose a reason for hiding this comment

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

this assignment will cost a lot of time. is there a better way?

Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe you can reference to the implementation in flip and use a copy_func to fill the elements in new_out.

src/flag_gems/ops/conv2d.py Show resolved Hide resolved
@StrongSpoon StrongSpoon mentioned this pull request Jan 20, 2025
Copy link
Collaborator

@StrongSpoon StrongSpoon left a comment

Choose a reason for hiding this comment

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

done


gems_assert_close(res_in_grad, ref_in_grad.to(dtype), dtype)
gems_assert_close(
res_in_grad.to(dtype), ref_in_grad.to(dtype), dtype, reduce_dim=weight.shape[2]
Copy link
Collaborator

Choose a reason for hiding this comment

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

casting is useless here. gems_assert_close will do type casting for reference tensors.

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