Rate this Page

Function torch::nn::functional::margin_ranking_loss#

Function Documentation#

inline Tensor torch::nn::functional::margin_ranking_loss(const Tensor &input1, const Tensor &input2, const Tensor &target, const MarginRankingLossFuncOptions &options = {})#

See https://pytorch.org/docs/main/nn.functional.html#torch.nn.functional.margin_ranking_loss about the exact behavior of this functional.

See the documentation for torch::nn::functional::MarginRankingLossFuncOptions class to learn what optional arguments are supported for this functional.

Example:

namespace F = torch::nn::functional;
F::margin_ranking_loss(input1, input2, target,
F::MarginRankingLossFuncOptions().margin(0.5).reduction(torch::kSum));