的值ignore_index
必须是int,这就是为什么默认值是int而不是None
。默认值是任意的,它可以是任何负数,即不是“有效”类标签的任何值。该函数将忽略目标实例具有该类标签的所有元素。实际上,此选项可用于识别未标记的像素,例如在密集预测任务中。
编辑:追溯 的实现,我们可以在 的实现nn.NLLLoss
中找到此注释:nll_loss
torch/onnx/symbolic_opset12.py
# in onnx NegativeLogLikelihoodLoss specification, ignore_index is optional without default value.
# therefore we need to set ignore_index attribute even if it is not specified (e.g. ignore_index=-100).
ignore_index = sym_help._maybe_get_const(ignore_index, "i")
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
814 次 |
最近记录: |