Method trueIdx
static member trueIdx: Tensor<bool> -> Tensor<int64>
Finds the indices of all element that are true.
Declaration
static member trueIdx: src:Tensor<bool> -> Tensor<int64>
Parameters
Type | Name | Description |
---|---|---|
Tensor<bool> | src | The tensor containing the source values. |
Returns
Type | Description |
---|---|
Tensor<int64> | A matrix that has one row per true entry in |
Remarks
The function searches for elements that are true and for each one it creates a row in the result matrix consisting of the indices of the element.
Examples
let a = HostTensor.ofList2D [[true; false; true; false]
[false; true; true; false]]
let b = Tensor.trueIdx a // b = [[0L; 0L]
// [0L; 2L]
// [1L; 1L]
// [1L; 2L]]