• Searches for where a value would go in a sorted sequence.

    This is not a method for checking containment (like javascript in).

    The typical use case for this operation is "binning", "bucketing", or "discretizing". The values are assigned to bucket-indices based on the edges listed in 'sortedSequence'. This operation returns the bucket-index for each value.

    The index returned corresponds to the first edge greater than or equal to the value.

    The axis is not settable for this operation. It always operates on the innermost dimension (axis=-1). The operation will accept any number of outer dimensions.

    Note: This operation assumes that 'lowerBound' is sorted along the innermost axis, maybe using 'sort(..., axis=-1)'. If the sequence is not sorted no error is raised and the content of the returned tensor is not well defined.

    const edges = tf.tensor1d([-1, 3.3, 9.1, 10.0]);
    let values = tf.tensor1d([0.0, 4.1, 12.0]);
    const result1 = tf.lowerBound(edges, values);
    result1.print(); // [1, 2, 4]

    const seq = tf.tensor1d([0, 3, 9, 10, 10]);
    values = tf.tensor1d([0, 4, 10]);
    const result2 = tf.lowerBound(seq, values);
    result2.print(); // [0, 2, 3]

    const sortedSequence = tf.tensor2d([[0., 3., 8., 9., 10.],
    [1., 2., 3., 4., 5.]]);
    values = tf.tensor2d([[9.8, 2.1, 4.3],
    [0.1, 6.6, 4.5, ]]);
    const result3 = tf.lowerBound(sortedSequence, values);
    result3.print(); // [[4, 1, 2], [0, 5, 4]]

    Parameters

    Returns Tensor

    An N-D int32 tensor the size of values containing the result of applying lower bound to each value. The result is not a global index to the entire Tensor, but the index in the last dimension.

    Doc

Generated using TypeDoc