Partager via


TensorPrimitives.Tanh Method

Definition

Overloads

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

Computes the element-wise hyperbolic tangent of each single-precision floating-point radian angle in the specified tensor.

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

Computes the element-wise hyperbolic tangent of each radian angle in the specified tensor.

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

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

Computes the element-wise hyperbolic tangent of each single-precision floating-point radian angle in the specified tensor.

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

If a value is equal to NegativeInfinity, the corresponding destination location is set to -1. If a value is equal to PositiveInfinity, the corresponding destination location is set to 1. If a value is equal to NaN, the corresponding destination location is set to NaN.

The angles in x must be in radians. Use DegreesToRadians(Single) or multiply by PI/180 to convert degrees to radians.

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

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

Source:
TensorPrimitives.Tanh.cs
Source:
TensorPrimitives.Tanh.cs

Computes the element-wise hyperbolic tangent of each radian angle in the specified tensor.

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

If a value is equal to NegativeInfinity, the corresponding destination location is set to -1. If a value is equal to PositiveInfinity, the corresponding destination location is set to 1. If a value is equal to NaN, the corresponding destination location is set to NaN.

The angles in x must be in radians. Use DegreesToRadians(Single) or multiply by T.Pi / 180 to convert degrees to radians.

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