-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Closed
Labels
actionablehigh prioritymodule: correctness (silent)issue that returns an incorrect result silentlyissue that returns an incorrect result silentlymodule: cppRelated to C++ APIRelated to C++ APImodule: lossProblem is related to loss functionProblem is related to loss functiontriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
🐛 Describe the bug
Pull request #44433 added beta to the SmoothL1Options structure but overrides it in the functional call:
In nn/functional/loss.h:
inline Tensor smooth_l1_loss(
const Tensor& input,
const Tensor& target,
const SmoothL1LossFuncOptions& options = {},
double beta = 1.) {
return detail::smooth_l1_loss(input, target, options.reduction(), beta);
}
If a beta is specified in the options, it will be overridden by the default in a call like:
torch::nn::functional::smooth_l1_loss(inputs, targets, options.beta(.5));
I think the definition in nn/functional/loss.h should remove the added beta in the arguments and reference it in the call to the detail function:
inline Tensor smooth_l1_loss(
const Tensor& input,
const Tensor& target,
const SmoothL1LossFuncOptions& options = {})
return detail::smooth_l1_loss(input, target, options.reduction(), options.beta());
}
Versions
All libtorch versions from 1.7.0
Metadata
Metadata
Assignees
Labels
actionablehigh prioritymodule: correctness (silent)issue that returns an incorrect result silentlyissue that returns an incorrect result silentlymodule: cppRelated to C++ APIRelated to C++ APImodule: lossProblem is related to loss functionProblem is related to loss functiontriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module