TensorPrimitives.Sign<T> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Computes the element-wise sign of numbers in the specified tensor.
public:
generic <typename T>
where T : System::Numerics::INumber<T> static void Sign(ReadOnlySpan<T> x, Span<int> destination);
public static void Sign<T>(ReadOnlySpan<T> x, Span<int> destination) where T : System.Numerics.INumber<T>;
static member Sign : ReadOnlySpan<'T (requires 'T :> System.Numerics.INumber<'T>)> * Span<int> -> unit (requires 'T :> System.Numerics.INumber<'T>)
Public Shared Sub Sign(Of T As INumber(Of T)) (x As ReadOnlySpan(Of T), destination As Span(Of Integer))
Type Parameters
- T
Parameters
The 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
. If the value is less than 0, the result is -1; if the value is 0, the result is 0; if the value is greater than 0, the result is 1.destination
[i] = T.Sign(x
[i])