You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
torch.nn.functional.l1_loss computes a criterion with the MSE, not the MAE #1359
The L1Loss should create a criterion that measures the MAE error, but in TorchSharp it measures the MSE.
I believe that this is incorrect. See the following screenshot comparing TorchSharp and pytorch, which I believe should get identical results, but don't:
auto opts = torch::nn::functional::MSELossFuncOptions();
ApplyReduction(opts, reduction);
res = ResultTensor(torch::nn::functional::mse_loss(*input, *target, opts));
)
}
If this is indeed incorrect, I would be happy to submit a fix in a PR, but am still figuring out how to make my projects use the locally built version of TorchSharp—I'm not the biggest C# / dotnet / nuget expert.
Thanks, I had the same diff in RensOliemans@1f7e50b but didn't push it yet: I haven't figured out how to build the TorchSharp so that I get a .nupkg that I can test locally. Is that possible on Linux?
Activity
NiklasGustafsson commentedon Jul 18, 2024
Thank you for the report.
You are correct, the C++ implementation calls the wrong libtorch function -- mse_loss() instead of l1_loss().
I can fix it, or you can submit a PR and get yourself on our 'Contributor' board... :-)
Address issue dotnet#1359
NiklasGustafsson commentedon Jul 19, 2024
@RensOliemans -- take a look at #1360
Fix calculation of L1Loss
RensOliemans commentedon Jul 19, 2024
Thanks, I had the same diff in RensOliemans@1f7e50b but didn't push it yet: I haven't figured out how to build the TorchSharp so that I get a
.nupkgthat I can test locally. Is that possible on Linux?NiklasGustafsson commentedon Jul 19, 2024
Does
dotnet packnot work?NiklasGustafsson commentedon Jul 19, 2024
You can look in the azure_pipeline.yaml file for the exact CLI arguments to provide to
dotnet packMerge pull request #1360 from NiklasGustafsson/bugs
RensOliemans commentedon Jul 19, 2024