pytorch: grad can be implicitly created only for scalar outputs
输出是个张量,不是标量的原因。
RuntimeError: cannot perform reduction function min on tensor with no elements because the operation does not have an identity
用到三元损失函数,报上边的错误。检查发现是因为batch设置为4. 无法保证采样的图片有一个正样本一个负样本。