TensorPrimitives.Log2 Method

Definition

Overloads

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

Computes the element-wise base 2 logarithm of single-precision floating-point numbers in the specified tensor.

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

Computes the element-wise base 2 logarithm of numbers in the specified tensor.

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

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

Computes the element-wise base 2 logarithm of single-precision floating-point numbers in the specified tensor.

public:
 static void Log2(ReadOnlySpan<float> x, Span<float> destination);
public static void Log2 (ReadOnlySpan<float> x, Span<float> destination);
static member Log2 : ReadOnlySpan<single> * Span<single> -> unit
Public Shared Sub Log2 (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.Log2(x[i]).

If a value equals 0, the result stored into the corresponding destination location is set to NegativeInfinity. If a value is negative or equal to NaN, the result stored into the corresponding destination location is set to NaN. If a value is positive infinity, the result stored into the corresponding destination location is set to PositiveInfinity. Otherwise, if a value is positive, its natural logarithm is stored into the corresponding destination location.

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

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

Source:
TensorPrimitives.Log2.cs
Source:
TensorPrimitives.Log2.cs

Computes the element-wise base 2 logarithm of numbers in the specified tensor.

public:
generic <typename T>
 where T : System::Numerics::ILogarithmicFunctions<T> static void Log2(ReadOnlySpan<T> x, Span<T> destination);
public static void Log2<T> (ReadOnlySpan<T> x, Span<T> destination) where T : System.Numerics.ILogarithmicFunctions<T>;
static member Log2 : ReadOnlySpan<'T (requires 'T :> System.Numerics.ILogarithmicFunctions<'T>)> * Span<'T (requires 'T :> System.Numerics.ILogarithmicFunctions<'T>)> -> unit (requires 'T :> System.Numerics.ILogarithmicFunctions<'T>)
Public Shared Sub Log2(Of T As ILogarithmicFunctions(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.

Remarks

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

If a value equals 0, the result stored into the corresponding destination location is set to NegativeInfinity. If a value is negative or equal to NaN, the result stored into the corresponding destination location is set to NaN. If a value is positive infinity, the result stored into the corresponding destination location is set to PositiveInfinity. Otherwise, if a value is positive, its base 2 logarithm is stored into the corresponding destination location.

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