Python wrappers
Public Python APIs implemented by this engine symbol.Autograd node for the multi-axis reduction product .
The gradient is the "product of all other elements" of 's slice. It is only where , so it is formed from the saved input with the slice's zeros split out rather than divided by: a zero gets the product of the rest (0 when the slice has another zero).
Because no single IBackend overload spans every Accelerate /
MLX combination, prod provides explicit cpu_kernel and
gpu_kernel overloads instead of a shared dispatch.
Math
Attributes
schema_ v1OpSchema"prod" with AmpPolicy::KeepInput.kSavesInputbooltrue.kSavesOutputboolfalse.Notes
CPU path iterates axes in descending order so the lower indices
remain valid as dimensions are successively collapsed. GPU path
delegates to mlx::core::prod with keepdims. Empty
reductions return (multiplicative identity).
Static methods
2cpu_kernel
CpuStorage cpu_kernel(const CpuStorage & a, const int & in_shape, const int & axes, bool keepdims, Dtype dt)CPU path: iterates axes in descending order (innermost last) to produce a correct sequential multi-axis product using Accelerate primitives.
gpu_kernel
GpuStorage gpu_kernel(const GpuStorage & a, const int & in_shape, const int & axes, bool keepdims, Dtype dt)GPU path: delegates to mlx::core::prod with keepdims.
Methods
2Backward — , formed from the saved input.
Graph-mode scaling. Without this the base class returns the broadcast gradient unchanged — the sum rule — so create_graph=True silently produced the incoming seed at every position while eager backward was correct.