public static double cosineSim(@NonNull INDArray d1, @NonNull INDArray d2) {
        return Nd4j.getExecutioner().exec(new CosineSimilarity(d1, d2)).getDouble(0);
    }
public static double cosineSim ( @ NonNull INDArray d1 , @ NonNull INDArray d2 ) { return Nd4j . getExecutioner ( ) . exec ( new CosineSimilarity ( d1 , d2 ) ) . getDouble ( 0 ) ; }
Cosine similarity

@param d1 the first vector
@param d2 the second vector
@return the cosine similarities between the 2 arrays