tf.raw_ops.RaggedTensorFromVariant
Stay organized with collections
Save and categorize content based on your preferences.
Decodes a variant
Tensor into a RaggedTensor
.
tf.raw_ops.RaggedTensorFromVariant(
encoded_ragged,
input_ragged_rank,
output_ragged_rank,
Tvalues,
Tsplits=tf.dtypes.int64
,
name=None
)
Decodes the given variant
Tensor and returns a RaggedTensor
. The input
could be a scalar, meaning it encodes a single RaggedTensor
with ragged_rank
output_ragged_rank
. It could also have an arbitrary rank, in which case each
element is decoded into a RaggedTensor
with ragged_rank input_ragged_rank
and these are then stacked according to the input shape to output a single
RaggedTensor
with ragged_rank output_ragged_rank
. Each variant
element in
the input Tensor is decoded by retrieving from the element a 1-D variant
Tensor with input_ragged_rank + 1
Tensors, corresponding to the splits and
values of the decoded RaggedTensor
. If input_ragged_rank
is -1, then it is
inferred as output_ragged_rank
- rank(encoded_ragged)
. See
RaggedTensorToVariant
for the corresponding encoding logic.
Args |
encoded_ragged
|
A Tensor of type variant .
A variant Tensor containing encoded RaggedTensor s.
|
input_ragged_rank
|
An int that is >= -1 .
The ragged rank of each encoded RaggedTensor component in the input. If set to
-1, this is inferred as output_ragged_rank - rank(encoded_ragged)
|
output_ragged_rank
|
An int that is >= 0 .
The expected ragged rank of the output RaggedTensor . The following must hold:
output_ragged_rank = rank(encoded_ragged) + input_ragged_rank .
|
Tvalues
|
A tf.DType .
|
Tsplits
|
An optional tf.DType from: tf.int32, tf.int64 . Defaults to tf.int64 .
|
name
|
A name for the operation (optional).
|
Returns |
A tuple of Tensor objects (output_nested_splits, output_dense_values).
|
output_nested_splits
|
A list of output_ragged_rank Tensor objects with type Tsplits .
|
output_dense_values
|
A Tensor of type Tvalues .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[],[],null,["# tf.raw_ops.RaggedTensorFromVariant\n\n\u003cbr /\u003e\n\nDecodes a `variant` Tensor into a `RaggedTensor`.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.raw_ops.RaggedTensorFromVariant`](https://www.tensorflow.org/api_docs/python/tf/raw_ops/RaggedTensorFromVariant)\n\n\u003cbr /\u003e\n\n tf.raw_ops.RaggedTensorFromVariant(\n encoded_ragged,\n input_ragged_rank,\n output_ragged_rank,\n Tvalues,\n Tsplits=../../tf/dtypes#int64,\n name=None\n )\n\nDecodes the given `variant` Tensor and returns a `RaggedTensor`. The input\ncould be a scalar, meaning it encodes a single `RaggedTensor` with ragged_rank\n`output_ragged_rank`. It could also have an arbitrary rank, in which case each\nelement is decoded into a `RaggedTensor` with ragged_rank `input_ragged_rank`\nand these are then stacked according to the input shape to output a single\n`RaggedTensor` with ragged_rank `output_ragged_rank`. Each `variant` element in\nthe input Tensor is decoded by retrieving from the element a 1-D `variant`\nTensor with `input_ragged_rank + 1` Tensors, corresponding to the splits and\nvalues of the decoded `RaggedTensor`. If `input_ragged_rank` is -1, then it is\ninferred as `output_ragged_rank` - `rank(encoded_ragged)`. See\n`RaggedTensorToVariant` for the corresponding encoding logic.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `encoded_ragged` | A `Tensor` of type `variant`. A `variant` Tensor containing encoded `RaggedTensor`s. |\n| `input_ragged_rank` | An `int` that is `\u003e= -1`. The ragged rank of each encoded `RaggedTensor` component in the input. If set to -1, this is inferred as `output_ragged_rank` - `rank(encoded_ragged)` |\n| `output_ragged_rank` | An `int` that is `\u003e= 0`. The expected ragged rank of the output `RaggedTensor`. The following must hold: `output_ragged_rank = rank(encoded_ragged) + input_ragged_rank`. |\n| `Tvalues` | A [`tf.DType`](../../tf/dtypes/DType). |\n| `Tsplits` | An optional [`tf.DType`](../../tf/dtypes/DType) from: `tf.int32, tf.int64`. Defaults to [`tf.int64`](../../tf#int64). |\n| `name` | A name for the operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|------------------------|----------------------------------------------------------------------|\n| A tuple of `Tensor` objects (output_nested_splits, output_dense_values). ||\n| `output_nested_splits` | A list of `output_ragged_rank` `Tensor` objects with type `Tsplits`. |\n| `output_dense_values` | A `Tensor` of type `Tvalues`. |\n\n\u003cbr /\u003e"]]