DeepLink-org / DIOPI

BSD 3-Clause "New" or "Revised" License
68 stars 34 forks source link

Fix backward operator return values to respect requires_grad settings #1323

Closed guozixu2001 closed 3 months ago

guozixu2001 commented 3 months ago

Motivation and Context

There are some error when running resnet50 testcase

image

image

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

Use cases (Optional)

BC-breaking (Optional)

Checklist

Before PR:

After PR: