pytorch
7b31ba47 - Fix cudnn ctc loss backward (#56639)

Commit
5 years ago
Fix cudnn ctc loss backward (#56639) Summary: Fix cudnn ctc loss backward Fix https://github.com/pytorch/pytorch/issues/49046, which was working in pytorch 1.1 Originally modified in this PR in Oct 2019, https://github.com/pytorch/pytorch/pull/27039/files#diff-25ec2c1108ee03e2167622588ec31d167897ef1cccb12a4cfe77eb98777316daR2383-R2392 According to the original code https://github.com/pytorch/pytorch/blob/90ffab6e3713a40f47f4c9d3d3b16d56e83f97c4/tools/autograd/derivatives.yaml#L1387-L1388 and the code after PR https://github.com/pytorch/pytorch/blob/f461184505149560803855f3a40d9e0e54c64826/tools/autograd/templates/Functions.cpp#L2456-L2465 This `at::zeros({0}, raw_grad.options())` in line 2460 seems suspicious, and is causing `infer_size` runtime error ``` RuntimeError: The size of tensor a (0) must match the size of tensor b (177) at non-singleton dimension 2 Exception raised from infer_size at ..\aten\src\ATen\ExpandUtils.cpp:24 (most recent call first): ``` I've modified that to `at::zeros_like(raw_grad)`, which looks more accurate. Pull Request resolved: https://github.com/pytorch/pytorch/pull/56639 Reviewed By: mruberry Differential Revision: D27987860 Pulled By: ngimel fbshipit-source-id: 5ad65e78d017c26894fb26318a5992b0878d04d5
Author
Parents
Loading