Share via


TensorPrimitives.IndexOfMax Method

Definition

Overloads

IndexOfMax(ReadOnlySpan<Single>)

Searches for the index of the largest single-precision floating-point number in the specified tensor.

IndexOfMax<T>(ReadOnlySpan<T>)

Searches for the index of the largest number in the specified tensor.

IndexOfMax(ReadOnlySpan<Single>)

Source:
TensorPrimitives.cs
Source:
TensorPrimitives.Single.cs
Source:
TensorPrimitives.Single.cs

Searches for the index of the largest single-precision floating-point number in the specified tensor.

public:
 static int IndexOfMax(ReadOnlySpan<float> x);
public static int IndexOfMax (ReadOnlySpan<float> x);
static member IndexOfMax : ReadOnlySpan<single> -> int
Public Shared Function IndexOfMax (x As ReadOnlySpan(Of Single)) As Integer

Parameters

x
ReadOnlySpan<Single>

The tensor, represented as a span.

Returns

The index of the maximum element in x, or -1 if x is empty.

Remarks

The determination of the maximum element matches the IEEE 754:2019 `maximum` function. If any value equal to NaN is present, the index of the first is returned. Positive 0 is considered greater than negative 0.

This method may call into the underlying C runtime or employ instructions specific to the current architecture. Exact results may differ between different operating systems or architectures.

Applies to

IndexOfMax<T>(ReadOnlySpan<T>)

Source:
TensorPrimitives.IndexOfMax.cs
Source:
TensorPrimitives.IndexOfMax.cs

Searches for the index of the largest number in the specified tensor.

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

Type Parameters

T

Parameters

x
ReadOnlySpan<T>

The tensor, represented as a span.

Returns

The index of the maximum element in x, or -1 if x is empty.

Remarks

The determination of the maximum element matches the IEEE 754:2019 `maximum` function. If any value equal to NaN is present, the index of the first is returned. Positive 0 is considered greater than negative 0.

This method may call into the underlying C runtime or employ instructions specific to the current architecture. Exact results may differ between different operating systems or architectures.

Applies to