Open randolf-scholz opened 2 years ago
It is supported by providing callables for reductions in einops.reduce
. Some examples:
# numpy
einops.reduce(array, 'i j k -> (i j)', np.nanmean)
# torch
einops.reduce(array, 'i j k -> (i j)', torch.nanmean)
Numpy and many other libraries have introduced additional aggregation functions that ignore π½ππ½-values, for instance:
numpy.nan[sum, mean, min, max, argmin, argmax, median, std, var, prod, quantile, percentile]
torch.nan[sum, mean, median, quantile]
tensorflow.experimental.numpy
jax.numpy
ignore_nan
forreduce
nanreduce
that does the same thing but is visually more striking.Similarly, one could consider an additional
ignore_infinite
-flag.