code: public SDVariable cosineDistance(String name, @NonNull SDVariable label, @NonNull SDVariable predictions,
                                       SDVariable weights, @NonNull LossReduce lossReduce, int dimension) {
          validateFloatingPoint("cosine distance loss", "predictions", predictions);
          validateNumerical("cosine distance loss", "labels", label);
          if (weights == null)
              weights = sd.scalar(null, predictions.dataType(), 1.0);
          SDVariable result = f().lossCosineDistance(label, predictions, weights, lossReduce, dimension);
          result = updateVariableNameAndReference(result, name);
          result.markAsLoss();
          return result;
      }
docs: Cosine distance loss: {@code 1 - cosineSimilarity(x,y)} or {@code 1 - sum_i label[i] * prediction[i]}, which is
  equivalent to cosine distance when both the predictions and labels are normalized.<br>
  <b>Note</b>: This loss function assumes that both the predictions and labels are normalized to have unit l2 norm.
  If this is not the case, you should normalize them first by dividing by {@link SameDiff#norm2(String, SDVariable, boolean, int...)}
  along the cosine distance dimension (with keepDims=true).
  
  @param name        Name of the operation
  @param label       Label array
  @param predictions Predictions array
  @param weights     Weights array. May be null. If null, a weight of 1.0 is used
  @param lossReduce  Reduction type for the loss. See {@link LossReduce} for more details. Default: {@link LossReduce#MEAN_BY_NONZERO_WEIGHT_COUNT}
  @param dimension   Dimension to perform the cosine distance over
  @return Cosine distance loss variable