static ValueAggregator ofType(Aggregator aggregator) {
            return switch (aggregator) {
                case avg -> new AvgAggregator();
                case count -> new CountAggregator();
                case max -> new MaxAggregator();
                case median -> new MedianAggregator();
                case min -> new MinAggregator();
                case prod -> new ProdAggregator();
                case sum -> new SumAggregator();
                default -> throw new UnsupportedOperationException("Aggregator " + aggregator + " is not implemented");
            };

        }
Creates a reduce function.

@param argument the tensor to reduce
@param aggregator the aggregator function to use
@param dimensions the list of dimensions to remove. If an empty list is given, all dimensions are reduced,
                  producing a dimensionless tensor (a scalar).
@throws IllegalArgumentException if any of the tensor dimensions are not present in the input tensor
vespajlib/src/main/java/com/yahoo/tensor/functions/Reduce.java