APISonar


org.nd4j.autodiff.samediff.SameDiff.log

> org > nd4j > autodiff > samediff > SameDiff > log
org APIs nd4j APIs autodiff APIs samediff APIs SameDiff APIs log APIs

Example 1
public static LossInfo mcxent(String outputName, SDVariable predictions, SDVariable label, SDVariable weights,
                                  Reduction reduction, int... dimensions){
        LossInfo.Builder b = validate("mcxent", predictions, label, reduction);
        SameDiff sd = predictions.getSameDiff();

        if(weights == null){
            weights = sd.one("mcxent_loss_weights", SCALAR);
        }

        String name = (reduction == Reduction.NONE ? outputName : null);
        SDVariable weightedLogProd = sd.log(predictions).mul(label).mul(name, weights);

        return doReduce(sd, outputName, false, b, reduction, weightedLogProd, label, weights, dimensions);
    }