s2t.LeafNodeTensor

May 7, 2026 ยท View on GitHub

description: The value of a leaf node.

s2t.LeafNodeTensor

The value of a leaf node.

`parent_index` a 1-D int64 tensor where parent_index[i] represents the parent index of values[i]
`values` a 1-D tensor of equal length to parent_index.
`is_repeated` a bool indicating if there can be more than one child per parent.
`is_repeated`
`parent_index`
`values`

Methods

get_positional_index

View source

Gets the positional index for this LeafNodeTensor.

The positional index tells us which index of the parent an element is.

For example, with the following parent indices: [0, 0, 2] we would have positional index: [ 0, # The 0th element of the 0th parent. 1, # The 1st element of the 0th parent. 0 # The 0th element of the 2nd parent. ].

For more information, view ops/run_length_before_op.cc

This is the same for Child NodeTensors.

Returns
A tensor of positional indices.