• Applies a list of indices of a tensor in sorted order of their corresponding values in the tensor to the given outTensor. Only indices whose corresponding values are not equal to 0 in the provided mask will be returned. Indices from the original tensor, before applying the mask, will be returned in the provided array. Returns the size of the list of indices applied to the outTensor (note: this will be equal to the number of non-zero values provided in the mask). eg:

    var inTensor = [5.0, 2.0, 1.0, 3.0, 7.0, -1.0, -5.0]; 
    var mask = [1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0];
    var outTensor = new Uint32Array(7);
    var order = SortOrder.Ascending;
    var size = TensorMath.argSortMasked(inTensor, mask, outTensor, order);
    print(outTensor.subarray(size)); // Expected: [2, 1, 3, 0, 4]

    Parameters

    • inTensor: Float32Array
    • mask: Float32Array
    • outTensor: Uint32Array
    • order: SortOrder

    Returns number