TypeTensor - v0.1.0
    Preparing search index...

    Type Alias MeanOp<Input, Axes, KeepDims, OutputDType>

    MeanOp: ValidateReduction<Input["__shape"], Axes> extends true
        ? StorageTransformation<
            "mean",
            TensorStorage<
                OutputDType,
                ComputeReductionShape<Input["__shape"], Axes, KeepDims>,
                ComputeStrides<ComputeReductionShape<Input["__shape"], Axes, KeepDims>>,
                ReductionOpLayout<Input["__layout"]>,
            >,
            readonly [Input],
        > & { __keepDims: KeepDims; __meanAxes: Axes }
        : never

    Mean reduction operation Computes the mean of tensor elements along specified axes

    Type Parameters

    • Input extends AnyTensorStorage

      Input tensor storage type

    • Axes extends readonly number[] | undefined

      Axes to reduce along (undefined means reduce all)

    • KeepDims extends boolean = false

      Whether to keep reduced dimensions as size 1

    • OutputDType extends AnyDType = ToFloat<Input["__dtype"]>

      Output data type (defaults to float version of input)

    // Mean along last axis, keep dimension
    type Input = TensorStorage<Int32, [2, 3, 4], [12, 4, 1], DefaultLayoutFlags>;
    type Result = MeanOp<Input, [-1], true>; // Shape: [2, 3, 1], DType: Float32
    // Global mean (all elements)
    type GlobalMean = MeanOp<Input, undefined, false>; // Shape: [], DType: Float32