private static SDVariable nonZeroCount(SDVariable weights, SDVariable labels){
        SameDiff sd = weights.getSameDiff();

        SDVariable present = sd.neq(weights, 0.0);
        SDVariable presentBroadcast = sd.zerosLike(labels).add(present);

        return sd.sum(presentBroadcast);
    }
private static SDVariable nonZeroCount(SDVariable weights, SDVariable labels){
        SameDiff sd = weights.getSameDiff();

        SDVariable present = sd.neq(weights, 0.0);
        SDVariable presentBroadcast = sd.zerosLike(labels).add(present);

        return sd.sum(presentBroadcast);
    }
private static SDVariable nonZeroCount ( SDVariable weights , SDVariable labels ) { SameDiff sd = weights . getSameDiff ( ) ; SDVariable present = sd . neq ( weights , 0.0 ) ; SDVariable presentBroadcast = sd . zerosLike ( labels ) . add ( present ) ; return sd . sum ( presentBroadcast ) ; }
Determine the number of weight entries that are non-zero, after broadcasting

@param weights
@param labels
@return
Determine the number of weight entries that are non - zero after broadcasting