8000 `torch.nn.functional.l1_loss` computes a criterion with the MSE, not the MAE · Issue #1359 · dotnet/TorchSharp · GitHub
[go: up one dir, main page]

Skip to content
torch.nn.functional.l1_loss computes a criterion with the MSE, not the MAE #1359
@RensOliemans

Description

@RensOliemans

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:
image

See the call to functional::mse_loss:

Tensor THSNN_l1_loss(const Tensor input, const Tensor target, const int64_t reduction)
{
CATCH_RETURN_Tensor(
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0