Method Sgn
static member Sgn: Tensor<'T> -> Tensor<'T>
Element-wise sign.
Declaration
static member Sgn: a:Tensor<'T> -> Tensor<'T>
Parameters
Type | Name | Description |
---|---|---|
Tensor<'T> | a | The tensor to apply this operation to. |
Returns
Type | Description |
---|---|
Tensor<'T> | A new tensor containing the result of this operation. |
Remarks
Computes the sign of each element of the specified tensor and returns them as a new tensor.
The type of the returned tensor matches the type of the argument tensor.
Do not call this function directly; instead use the F# sgn
function.
Examples
let a = HostTensor.ofList [-2; -1; 0; 2]
let b = sgn a // b = [-1; -1; 0; 1]