mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Fix UndefinedGrad::apply (#160572)
The function incorrectly reserved space in the input parameter instead of the output parameter Pull Request resolved: https://github.com/pytorch/pytorch/pull/160572 Approved by: https://github.com/soulitzer
This commit is contained in:
parent
dc200066cf
commit
bbc7c03e93
|
|
@ -57,13 +57,7 @@ auto UndefinedGrad::apply(variable_list&& inputs) -> variable_list {
|
|||
|
||||
auto UndefinedGradBackward::apply(variable_list&& output_grads)
|
||||
-> variable_list {
|
||||
tensor_list input_grads;
|
||||
output_grads.reserve(input_grads.size());
|
||||
for (auto& grad : output_grads) {
|
||||
(void)grad; // Suppress unused variable warning
|
||||
input_grads.emplace_back();
|
||||
}
|
||||
return input_grads;
|
||||
return tensor_list(output_grads.size());
|
||||
}
|
||||
|
||||
auto Identity::apply(variable_list&& grads) -> variable_list {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user