Share via


TensorPrimitives.Abs Method

Definition

Overloads

Abs(ReadOnlySpan<Single>, Span<Single>)

Computes the element-wise absolute value of each single-precision floating-point number in the specified tensor.

Abs<T>(ReadOnlySpan<T>, Span<T>)

Computes the element-wise absolute value of each number in the specified tensor.

Abs(ReadOnlySpan<Single>, Span<Single>)

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

Computes the element-wise absolute value of each single-precision floating-point number in the specified tensor.

public:
 static void Abs(ReadOnlySpan<float> x, Span<float> destination);
public static void Abs (ReadOnlySpan<float> x, Span<float> destination);
static member Abs : ReadOnlySpan<single> * Span<single> -> unit
Public Shared Sub Abs (x As ReadOnlySpan(Of Single), destination As Span(Of Single))

Parameters

x
ReadOnlySpan<Single>

The tensor, represented as a span.

destination
Span<Single>

The destination tensor, represented as a span.

Exceptions

x and destination reference overlapping memory locations and do not begin at the same location.

Remarks

This method effectively computes destination[i] = MathF.Abs(x[i]).

The absolute value of a Single is its numeric value without its sign. For example, the absolute value of both 1.2e-03 and -1.2e03 is 1.2e03.

If a value is equal to NegativeInfinity or PositiveInfinity, the result stored into the corresponding destination location is set to PositiveInfinity. If a value is equal to NaN, the result stored into the corresponding destination location is the original NaN value with the sign bit removed.

Applies to

Abs<T>(ReadOnlySpan<T>, Span<T>)

Source:
TensorPrimitives.Abs.cs
Source:
TensorPrimitives.Abs.cs

Computes the element-wise absolute value of each number in the specified tensor.

public:
generic <typename T>
 where T : System::Numerics::INumberBase<T> static void Abs(ReadOnlySpan<T> x, Span<T> destination);
public static void Abs<T> (ReadOnlySpan<T> x, Span<T> destination) where T : System.Numerics.INumberBase<T>;
static member Abs : ReadOnlySpan<'T (requires 'T :> System.Numerics.INumberBase<'T>)> * Span<'T (requires 'T :> System.Numerics.INumberBase<'T>)> -> unit (requires 'T :> System.Numerics.INumberBase<'T>)
Public Shared Sub Abs(Of T As INumberBase(Of T)) (x As ReadOnlySpan(Of T), destination As Span(Of T))

Type Parameters

T

Parameters

x
ReadOnlySpan<T>

The tensor, represented as a span.

destination
Span<T>

The destination tensor, represented as a span.

Exceptions

x and destination reference overlapping memory locations and do not begin at the same location.

T is a signed integer type and x contained a value equal to T's minimum value.

Remarks

This method effectively computes destination[i] = T.Abs(x[i]).

The absolute value of a T is its numeric value without its sign. For example, the absolute value of both 1.2e-03 and -1.2e03 is 1.2e03.

If a value is equal to NegativeInfinity or PositiveInfinity, the result stored into the corresponding destination location is set to PositiveInfinity. If a value is equal to NaN, the result stored into the corresponding destination location is the original NaN value with the sign bit removed.

Applies to