Log-sum-exp reduction for mlx arrays
Arguments
- x
An mlx array, or an R array/matrix/vector that will be converted via
as_mlx().- axes
Integer vector of axes (1-indexed). Supply positive integers between 1 and the array rank. Many helpers interpret
NULLto mean "all axes"—see the function details for specifics.- drop
Logical indicating whether the reduced axes should be dropped (default
TRUE).
Examples
x <- mlx_matrix(1:6, 2, 3)
mlx_logsumexp(x)
#> mlx array []
#> dtype: float32
#> device: gpu
#> values:
#> [1] 6.456193
mlx_logsumexp(x, axes = 2)
#> mlx array [2]
#> dtype: float32
#> device: gpu
#> values:
#> [1] 5.142931 6.142931