description: A expression of NodeTensor objects.
View source on GitHub
|
A expression of NodeTensor objects.
s2t.Prensor(
node: s2t.NodeTensor,
children: "collections.OrderedDict[path.Step, Prensor]"
)
| `node` | the NodeTensor of the root. |
| `children` | a map from edge to subexpression. |
| `is_leaf` | True iff the node value is a LeafNodeTensor. |
| `node` | The node of the root of the subtree. |
field_names() -> FrozenSet[s2t.Step]
Returns the field names of the children.
get_child(
field_name: s2t.Step
) -> Optional['Prensor']
Gets the child at field_name.
get_child_or_error(
field_name: s2t.Step
) -> "Prensor"
Gets the child at field_name.
get_children() -> "collections.OrderedDict[path.Step, Prensor]"
A map from field name to subexpression.
get_descendant(
p: s2t.Path
) -> Optional['Prensor']
Finds the descendant at the path.
get_descendant_or_error(
p: s2t.Path
) -> "Prensor"
Finds the descendant at the path.
get_descendants() -> Mapping[path.Path, 'Prensor']
A map from paths to all subexpressions.
get_ragged_tensor(
p: s2t.Path,
options: calculate_options.Options = calculate_options.get_default_options()
) -> tf.RaggedTensor
Get a ragged tensor for a path.
All steps are represented in the ragged tensor.
| Args | |
|---|---|
| `p` | the path to a leaf node in `t`. |
| `options` | Options for calculating ragged tensors. |
| Returns | |
|---|---|
| A ragged tensor containing values of the leaf node, preserving the structure along the path. Raises an error if the path is not found. |
get_ragged_tensors(
options: calculate_options.Options = calculate_options.get_default_options()
) -> Mapping[s2t.Path, tf.RaggedTensor]
Gets ragged tensors for all the leaves of the prensor expression.
| Args | |
|---|---|
| `options` | Options for calculating ragged tensors. |
| Returns | |
|---|---|
| A map from paths to ragged tensors. |
get_sparse_tensor(
p: s2t.Path,
options: calculate_options.Options = calculate_options.get_default_options()
) -> tf.SparseTensor
Gets a sparse tensor for path p.
Note that any optional fields are not registered as dimensions, as they can't be represented in a sparse tensor.
| Args | |
|---|---|
| `p` | The path to a leaf node in `t`. |
| `options` | Currently unused. |
| Returns | |
|---|---|
| A sparse tensor containing values of the leaf node, preserving the structure along the path. Raises an error if the path is not found. |
get_sparse_tensors(
options: calculate_options.Options = calculate_options.get_default_options()
) -> Mapping[s2t.Path, tf.SparseTensor]
Gets sparse tensors for all the leaves of the prensor expression.
| Args | |
|---|---|
| `options` | Currently unused. |
| Returns | |
|---|---|
| A map from paths to sparse tensors. |
View source on GitHub