org.nd4j.linalg.api.ops.impl.loss.HuberLoss Maven / Gradle / Ivy
package org.nd4j.linalg.api.ops.impl.loss;
import org.nd4j.autodiff.loss.LossReduce;
import org.nd4j.autodiff.samediff.SDVariable;
import org.nd4j.autodiff.samediff.SameDiff;
import org.nd4j.base.Preconditions;
/**
* Huber loss
*
* @author Alex Black
*/
public class HuberLoss extends BaseLoss {
private double delta;
public HuberLoss(SameDiff sameDiff, LossReduce lossReduce, SDVariable predictions, SDVariable weights, SDVariable labels, double delta){
super(sameDiff, lossReduce, predictions, weights, labels);
Preconditions.checkState(delta >= 0.0, "Delta must be >= 0.0. Got: %s", delta);
this.delta = delta;
tArguments.add(delta);
}
public HuberLoss(){ }
@Override
public String opName() {
return "huber_loss";
}
}