There are some error when running resnet50 testcase
This change addresses an issue with the conv2d_backward function where it was returning unnecessary gradients even when requires_grad was not set for some parameters. By respecting the requires_grad settings, we ensure that only the required gradients are computed and returned.
Description
Modified the backward operator function to ensure that gradients are only included in the return dictionary if requires_grad is set to True for the respective parameters.
Updated the test template to correctly handle and pass requires_grad information from function_paras.
Updated the diopiTensor class definition to include the requires_grad attribute.
Use cases (Optional)
BC-breaking (Optional)
Checklist
Before PR:
[x] I have read and followed the workflow indicated in the Contributors.md to create this PR.
[x] Pre-commit or linting tools indicated in Contributors.md are used to fix the potential lint issues.
[x] Bug fixes are covered by unit tests, the case that causes the bug should be added in the unit tests.
[x] New functionalities are covered by complete unit tests. If not, please add more unit test to ensure the correctness.
[x] The documentation has been modified accordingly, including docstring or example tutorials.
After PR:
[x] CLA has been signed and all committers have signed the CLA in this PR.
Motivation and Context
There are some error when running resnet50 testcase
This change addresses an issue with the
conv2d_backward
function where it was returning unnecessary gradients even whenrequires_grad
was not set for some parameters. By respecting the requires_grad settings, we ensure that only the required gradients are computed and returned.Description
backward operator
function to ensure that gradients are only included in the return dictionary ifrequires_grad
is set to True for the respective parameters.requires_grad
information from function_paras.diopiTensor
class definition to include therequires_grad
attribute.Use cases (Optional)
BC-breaking (Optional)
Checklist
Before PR:
After PR: