Skip to content

Latest commit

 

History

History
142 lines (106 loc) · 2.75 KB

File metadata and controls

142 lines (106 loc) · 2.75 KB

description: The value of a leaf node.

s2t.LeafNodeTensor

View source on GitHub

The value of a leaf node.

s2t.LeafNodeTensor(
    parent_index: tf.Tensor,
    values: tf.Tensor,
    is_repeated: bool
)

Args

`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.

Attributes

`is_repeated`
`parent_index`
`values`

Methods

get_positional_index

View source

get_positional_index() -> tf.Tensor

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.