Share via


TensorPrimitives.Average<T>(ReadOnlySpan<T>) Method

Definition

Computes the mean of all elements in the specified non-empty tensor of numbers.

public:
generic <typename T>
 where T : System::Numerics::INumberBase<T> static T Average(ReadOnlySpan<T> x);
public static T Average<T>(ReadOnlySpan<T> x) where T : System.Numerics.INumberBase<T>;
static member Average : ReadOnlySpan<'T (requires 'T :> System.Numerics.INumberBase<'T>)> -> 'T (requires 'T :> System.Numerics.INumberBase<'T>)
Public Shared Function Average(Of T As INumberBase(Of T)) (x As ReadOnlySpan(Of T)) As T

Type Parameters

T

Parameters

x
ReadOnlySpan<T>

The tensor, represented as a span.

Returns

T

The mean of all elements in x.

Exceptions

Length of x must be greater than zero.

Remarks

If any of the input values is equal to NaN, the result value is also NaN.

Applies to