Commit 49c8e68
committed
[Accuracy diff] Fix accuracy diff for conv2d_transpose API with NHWC format
Fix gradient calculation error in conv2d_transpose when using NHWC format
with padding > 0. The issue was in im2col_cfo_cpu.h where incorrect index
calculation caused gradients to be shifted to wrong positions.
Key changes:
- Replace incorrect ternary operator index calculation with direct
calculation and boundary checking in NHWC branches
- Add TestWithSAMEPad_NHWC and TestWithSAMEPadGroups_NHWC test cases
- Ensure gradients match PyTorch reference implementation
- Fix code formatting to meet clang-format requirements1 parent f2933f3 commit 49c8e68
File tree
2 files changed
+60
-20
lines changed- paddle/phi/kernels/funcs
- test/legacy_test
2 files changed
+60
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
218 | 222 | | |
219 | 223 | | |
220 | 224 | | |
| |||
269 | 273 | | |
270 | 274 | | |
271 | 275 | | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
277 | 285 | | |
278 | 286 | | |
279 | 287 | | |
| |||
284 | 292 | | |
285 | 293 | | |
286 | 294 | | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
292 | 304 | | |
293 | 305 | | |
294 | 306 | | |
| |||
301 | 313 | | |
302 | 314 | | |
303 | 315 | | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
309 | 325 | | |
310 | 326 | | |
311 | 327 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1575 | 1575 | | |
1576 | 1576 | | |
1577 | 1577 | | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
1578 | 1602 | | |
1579 | 1603 | | |
0 commit comments