Type tf.ragged
Namespace tensorflow
Methods
- boolean_mask
- boolean_mask
- boolean_mask
- boolean_mask
- boolean_mask
- boolean_mask
- boolean_mask
- boolean_mask
- boolean_mask
- boolean_mask
- boolean_mask
- boolean_mask
- boolean_mask
- boolean_mask
- boolean_mask
- boolean_mask
- boolean_mask
- boolean_mask
- boolean_mask
- boolean_mask
- boolean_mask
- boolean_mask
- boolean_mask
- boolean_mask
- boolean_mask
- constant
- constant
- constant
- constant
- constant
- constant
- constant_dyn
- constant_value
- constant_value
- constant_value
- constant_value
- constant_value
- constant_value
- constant_value
- constant_value
- constant_value
- constant_value
- constant_value
- constant_value
- constant_value_dyn
- map_flat_values
- map_flat_values
- map_flat_values_dyn
- map_flat_values_dyn
- placeholder
- placeholder
- placeholder
- placeholder
- placeholder
- placeholder
- placeholder
- placeholder
- placeholder
- placeholder_dyn
- range
- range
- range
- range
- range
- range
- range
- range
- range
- range
- range
- range
- range
- range
- range
- range
- range_dyn
- row_splits_to_segment_ids
- row_splits_to_segment_ids
- row_splits_to_segment_ids
- row_splits_to_segment_ids_dyn
- segment_ids_to_row_splits
- segment_ids_to_row_splits
- segment_ids_to_row_splits
- segment_ids_to_row_splits
- segment_ids_to_row_splits_dyn
- stack
- stack
- stack
- stack_dyn
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions
- stack_dynamic_partitions_dyn
Properties
Public static methods
RaggedTensor boolean_mask(IGraphNodeBase data, object mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
IGraphNodeBase
data - A potentially ragged tensor.
-
object
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(object data, RaggedTensor mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
object
data - A potentially ragged tensor.
-
RaggedTensor
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(object data, DType mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
object
data - A potentially ragged tensor.
-
DType
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(object data, IEnumerable<object> mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
object
data - A potentially ragged tensor.
-
IEnumerable<object>
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(IGraphNodeBase data, IGraphNodeBase mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
IGraphNodeBase
data - A potentially ragged tensor.
-
IGraphNodeBase
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(IGraphNodeBase data, RaggedTensor mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
IGraphNodeBase
data - A potentially ragged tensor.
-
RaggedTensor
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(IGraphNodeBase data, DType mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
IGraphNodeBase
data - A potentially ragged tensor.
-
DType
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(IGraphNodeBase data, IEnumerable<object> mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
IGraphNodeBase
data - A potentially ragged tensor.
-
IEnumerable<object>
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(RaggedTensor data, object mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
RaggedTensor
data - A potentially ragged tensor.
-
object
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(RaggedTensor data, IGraphNodeBase mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
RaggedTensor
data - A potentially ragged tensor.
-
IGraphNodeBase
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(RaggedTensor data, RaggedTensor mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
RaggedTensor
data - A potentially ragged tensor.
-
RaggedTensor
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(RaggedTensor data, DType mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
RaggedTensor
data - A potentially ragged tensor.
-
DType
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(object data, IGraphNodeBase mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
object
data - A potentially ragged tensor.
-
IGraphNodeBase
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(RaggedTensor data, IEnumerable<object> mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
RaggedTensor
data - A potentially ragged tensor.
-
IEnumerable<object>
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(DType data, IGraphNodeBase mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
DType
data - A potentially ragged tensor.
-
IGraphNodeBase
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(DType data, RaggedTensor mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
DType
data - A potentially ragged tensor.
-
RaggedTensor
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(DType data, DType mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(DType data, IEnumerable<object> mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
DType
data - A potentially ragged tensor.
-
IEnumerable<object>
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(IEnumerable<object> data, object mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
IEnumerable<object>
data - A potentially ragged tensor.
-
object
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(IEnumerable<object> data, IGraphNodeBase mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
IEnumerable<object>
data - A potentially ragged tensor.
-
IGraphNodeBase
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(IEnumerable<object> data, RaggedTensor mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
IEnumerable<object>
data - A potentially ragged tensor.
-
RaggedTensor
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(IEnumerable<object> data, DType mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
IEnumerable<object>
data - A potentially ragged tensor.
-
DType
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(IEnumerable<object> data, IEnumerable<object> mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
IEnumerable<object>
data - A potentially ragged tensor.
-
IEnumerable<object>
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(DType data, object mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
DType
data - A potentially ragged tensor.
-
object
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
RaggedTensor boolean_mask(object data, object mask, string name)
Applies a boolean mask to `data` without flattening the mask dimensions. Returns a potentially ragged tensor that is formed by retaining the elements
in `data` where the corresponding value in `mask` is `True`. * `output[a1...aA, i, b1...bB] = data[a1...aA, j, b1...bB]` Where `j` is the `i`th `True` entry of `mask[a1...aA]`. Note that `output` preserves the mask dimensions `a1...aA`; this differs
from
tf.boolean_mask
, which flattens those dimensions.
Parameters
-
object
data - A potentially ragged tensor.
-
object
mask - A potentially ragged boolean tensor. `mask`'s shape must be a prefix of `data`'s shape. `rank(mask)` must be known statically.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A potentially ragged tensor that is formed by retaining the elements in `data` where the corresponding value in `mask` is `True`. * `rank(output) = rank(data)`. * `output.ragged_rank = max(data.ragged_rank, rank(mask) - 1)`.
object constant(int pylist, PythonClassContainer dtype, Nullable<int> ragged_rank, Nullable<ValueTuple<int>> inner_shape, string name, ImplicitContainer<T> row_splits_dtype)
Constructs a constant RaggedTensor from a nested Python list. Example:
All scalar values in `pylist` must have the same nesting depth `K`, and the
returned `RaggedTensor` will have rank `K`. If `pylist` contains no scalar
values, then `K` is one greater than the maximum depth of empty lists in
`pylist`. All scalar values in `pylist` must be compatible with `dtype`.
Parameters
-
int
pylist - A nested `list`, `tuple` or `np.ndarray`. Any nested element that is not a `list`, `tuple` or `np.ndarray` must be a scalar value compatible with `dtype`.
-
PythonClassContainer
dtype - The type of elements for the returned `RaggedTensor`. If not specified, then a default is chosen based on the scalar values in `pylist`.
-
Nullable<int>
ragged_rank - An integer specifying the ragged rank of the returned `RaggedTensor`. Must be nonnegative and less than `K`. Defaults to `max(0, K - 1)` if `inner_shape` is not specified. Defaults to `max(0, K - 1 - len(inner_shape))` if `inner_shape` is specified.
-
Nullable<ValueTuple<int>>
inner_shape - A tuple of integers specifying the shape for individual inner values in the returned `RaggedTensor`. Defaults to `()` if `ragged_rank` is not specified. If `ragged_rank` is specified, then a default is chosen based on the contents of `pylist`.
-
string
name - A name prefix for the returned tensor (optional).
-
ImplicitContainer<T>
row_splits_dtype - data type for the constructed `RaggedTensor`'s row_splits.
One of
tf.int32
ortf.int64
.
Returns
-
object
- A potentially ragged tensor with rank `K` and the specified `ragged_rank`, containing the values from `pylist`.
Show Example
>>> ragged.constant([[1, 2], [3], [4, 5, 6]]).eval() RaggedTensorValue(values=[1, 2, 3, 4, 5, 6], splits=[0, 2, 3, 6])
object constant(ndarray pylist, PythonClassContainer dtype, Nullable<int> ragged_rank, Nullable<ValueTuple<int>> inner_shape, string name, ImplicitContainer<T> row_splits_dtype)
Constructs a constant RaggedTensor from a nested Python list. Example:
All scalar values in `pylist` must have the same nesting depth `K`, and the
returned `RaggedTensor` will have rank `K`. If `pylist` contains no scalar
values, then `K` is one greater than the maximum depth of empty lists in
`pylist`. All scalar values in `pylist` must be compatible with `dtype`.
Parameters
-
ndarray
pylist - A nested `list`, `tuple` or `np.ndarray`. Any nested element that is not a `list`, `tuple` or `np.ndarray` must be a scalar value compatible with `dtype`.
-
PythonClassContainer
dtype - The type of elements for the returned `RaggedTensor`. If not specified, then a default is chosen based on the scalar values in `pylist`.
-
Nullable<int>
ragged_rank - An integer specifying the ragged rank of the returned `RaggedTensor`. Must be nonnegative and less than `K`. Defaults to `max(0, K - 1)` if `inner_shape` is not specified. Defaults to `max(0, K - 1 - len(inner_shape))` if `inner_shape` is specified.
-
Nullable<ValueTuple<int>>
inner_shape - A tuple of integers specifying the shape for individual inner values in the returned `RaggedTensor`. Defaults to `()` if `ragged_rank` is not specified. If `ragged_rank` is specified, then a default is chosen based on the contents of `pylist`.
-
string
name - A name prefix for the returned tensor (optional).
-
ImplicitContainer<T>
row_splits_dtype - data type for the constructed `RaggedTensor`'s row_splits.
One of
tf.int32
ortf.int64
.
Returns
-
object
- A potentially ragged tensor with rank `K` and the specified `ragged_rank`, containing the values from `pylist`.
Show Example
>>> ragged.constant([[1, 2], [3], [4, 5, 6]]).eval() RaggedTensorValue(values=[1, 2, 3, 4, 5, 6], splits=[0, 2, 3, 6])
object constant(IEnumerable<object> pylist, DType dtype, Nullable<int> ragged_rank, Nullable<ValueTuple<int>> inner_shape, string name, ImplicitContainer<T> row_splits_dtype)
Constructs a constant RaggedTensor from a nested Python list. Example:
All scalar values in `pylist` must have the same nesting depth `K`, and the
returned `RaggedTensor` will have rank `K`. If `pylist` contains no scalar
values, then `K` is one greater than the maximum depth of empty lists in
`pylist`. All scalar values in `pylist` must be compatible with `dtype`.
Parameters
-
IEnumerable<object>
pylist - A nested `list`, `tuple` or `np.ndarray`. Any nested element that is not a `list`, `tuple` or `np.ndarray` must be a scalar value compatible with `dtype`.
-
DType
dtype - The type of elements for the returned `RaggedTensor`. If not specified, then a default is chosen based on the scalar values in `pylist`.
-
Nullable<int>
ragged_rank - An integer specifying the ragged rank of the returned `RaggedTensor`. Must be nonnegative and less than `K`. Defaults to `max(0, K - 1)` if `inner_shape` is not specified. Defaults to `max(0, K - 1 - len(inner_shape))` if `inner_shape` is specified.
-
Nullable<ValueTuple<int>>
inner_shape - A tuple of integers specifying the shape for individual inner values in the returned `RaggedTensor`. Defaults to `()` if `ragged_rank` is not specified. If `ragged_rank` is specified, then a default is chosen based on the contents of `pylist`.
-
string
name - A name prefix for the returned tensor (optional).
-
ImplicitContainer<T>
row_splits_dtype - data type for the constructed `RaggedTensor`'s row_splits.
One of
tf.int32
ortf.int64
.
Returns
-
object
- A potentially ragged tensor with rank `K` and the specified `ragged_rank`, containing the values from `pylist`.
Show Example
>>> ragged.constant([[1, 2], [3], [4, 5, 6]]).eval() RaggedTensorValue(values=[1, 2, 3, 4, 5, 6], splits=[0, 2, 3, 6])
object constant(ndarray pylist, DType dtype, Nullable<int> ragged_rank, Nullable<ValueTuple<int>> inner_shape, string name, ImplicitContainer<T> row_splits_dtype)
Constructs a constant RaggedTensor from a nested Python list. Example:
All scalar values in `pylist` must have the same nesting depth `K`, and the
returned `RaggedTensor` will have rank `K`. If `pylist` contains no scalar
values, then `K` is one greater than the maximum depth of empty lists in
`pylist`. All scalar values in `pylist` must be compatible with `dtype`.
Parameters
-
ndarray
pylist - A nested `list`, `tuple` or `np.ndarray`. Any nested element that is not a `list`, `tuple` or `np.ndarray` must be a scalar value compatible with `dtype`.
-
DType
dtype - The type of elements for the returned `RaggedTensor`. If not specified, then a default is chosen based on the scalar values in `pylist`.
-
Nullable<int>
ragged_rank - An integer specifying the ragged rank of the returned `RaggedTensor`. Must be nonnegative and less than `K`. Defaults to `max(0, K - 1)` if `inner_shape` is not specified. Defaults to `max(0, K - 1 - len(inner_shape))` if `inner_shape` is specified.
-
Nullable<ValueTuple<int>>
inner_shape - A tuple of integers specifying the shape for individual inner values in the returned `RaggedTensor`. Defaults to `()` if `ragged_rank` is not specified. If `ragged_rank` is specified, then a default is chosen based on the contents of `pylist`.
-
string
name - A name prefix for the returned tensor (optional).
-
ImplicitContainer<T>
row_splits_dtype - data type for the constructed `RaggedTensor`'s row_splits.
One of
tf.int32
ortf.int64
.
Returns
-
object
- A potentially ragged tensor with rank `K` and the specified `ragged_rank`, containing the values from `pylist`.
Show Example
>>> ragged.constant([[1, 2], [3], [4, 5, 6]]).eval() RaggedTensorValue(values=[1, 2, 3, 4, 5, 6], splits=[0, 2, 3, 6])
object constant(IEnumerable<object> pylist, PythonClassContainer dtype, Nullable<int> ragged_rank, Nullable<ValueTuple<int>> inner_shape, string name, ImplicitContainer<T> row_splits_dtype)
Constructs a constant RaggedTensor from a nested Python list. Example:
All scalar values in `pylist` must have the same nesting depth `K`, and the
returned `RaggedTensor` will have rank `K`. If `pylist` contains no scalar
values, then `K` is one greater than the maximum depth of empty lists in
`pylist`. All scalar values in `pylist` must be compatible with `dtype`.
Parameters
-
IEnumerable<object>
pylist - A nested `list`, `tuple` or `np.ndarray`. Any nested element that is not a `list`, `tuple` or `np.ndarray` must be a scalar value compatible with `dtype`.
-
PythonClassContainer
dtype - The type of elements for the returned `RaggedTensor`. If not specified, then a default is chosen based on the scalar values in `pylist`.
-
Nullable<int>
ragged_rank - An integer specifying the ragged rank of the returned `RaggedTensor`. Must be nonnegative and less than `K`. Defaults to `max(0, K - 1)` if `inner_shape` is not specified. Defaults to `max(0, K - 1 - len(inner_shape))` if `inner_shape` is specified.
-
Nullable<ValueTuple<int>>
inner_shape - A tuple of integers specifying the shape for individual inner values in the returned `RaggedTensor`. Defaults to `()` if `ragged_rank` is not specified. If `ragged_rank` is specified, then a default is chosen based on the contents of `pylist`.
-
string
name - A name prefix for the returned tensor (optional).
-
ImplicitContainer<T>
row_splits_dtype - data type for the constructed `RaggedTensor`'s row_splits.
One of
tf.int32
ortf.int64
.
Returns
-
object
- A potentially ragged tensor with rank `K` and the specified `ragged_rank`, containing the values from `pylist`.
Show Example
>>> ragged.constant([[1, 2], [3], [4, 5, 6]]).eval() RaggedTensorValue(values=[1, 2, 3, 4, 5, 6], splits=[0, 2, 3, 6])
object constant(int pylist, DType dtype, Nullable<int> ragged_rank, Nullable<ValueTuple<int>> inner_shape, string name, ImplicitContainer<T> row_splits_dtype)
Constructs a constant RaggedTensor from a nested Python list. Example:
All scalar values in `pylist` must have the same nesting depth `K`, and the
returned `RaggedTensor` will have rank `K`. If `pylist` contains no scalar
values, then `K` is one greater than the maximum depth of empty lists in
`pylist`. All scalar values in `pylist` must be compatible with `dtype`.
Parameters
-
int
pylist - A nested `list`, `tuple` or `np.ndarray`. Any nested element that is not a `list`, `tuple` or `np.ndarray` must be a scalar value compatible with `dtype`.
-
DType
dtype - The type of elements for the returned `RaggedTensor`. If not specified, then a default is chosen based on the scalar values in `pylist`.
-
Nullable<int>
ragged_rank - An integer specifying the ragged rank of the returned `RaggedTensor`. Must be nonnegative and less than `K`. Defaults to `max(0, K - 1)` if `inner_shape` is not specified. Defaults to `max(0, K - 1 - len(inner_shape))` if `inner_shape` is specified.
-
Nullable<ValueTuple<int>>
inner_shape - A tuple of integers specifying the shape for individual inner values in the returned `RaggedTensor`. Defaults to `()` if `ragged_rank` is not specified. If `ragged_rank` is specified, then a default is chosen based on the contents of `pylist`.
-
string
name - A name prefix for the returned tensor (optional).
-
ImplicitContainer<T>
row_splits_dtype - data type for the constructed `RaggedTensor`'s row_splits.
One of
tf.int32
ortf.int64
.
Returns
-
object
- A potentially ragged tensor with rank `K` and the specified `ragged_rank`, containing the values from `pylist`.
Show Example
>>> ragged.constant([[1, 2], [3], [4, 5, 6]]).eval() RaggedTensorValue(values=[1, 2, 3, 4, 5, 6], splits=[0, 2, 3, 6])
object constant_dyn(object pylist, object dtype, object ragged_rank, object inner_shape, object name, ImplicitContainer<T> row_splits_dtype)
Constructs a constant RaggedTensor from a nested Python list. Example:
All scalar values in `pylist` must have the same nesting depth `K`, and the
returned `RaggedTensor` will have rank `K`. If `pylist` contains no scalar
values, then `K` is one greater than the maximum depth of empty lists in
`pylist`. All scalar values in `pylist` must be compatible with `dtype`.
Parameters
-
object
pylist - A nested `list`, `tuple` or `np.ndarray`. Any nested element that is not a `list`, `tuple` or `np.ndarray` must be a scalar value compatible with `dtype`.
-
object
dtype - The type of elements for the returned `RaggedTensor`. If not specified, then a default is chosen based on the scalar values in `pylist`.
-
object
ragged_rank - An integer specifying the ragged rank of the returned `RaggedTensor`. Must be nonnegative and less than `K`. Defaults to `max(0, K - 1)` if `inner_shape` is not specified. Defaults to `max(0, K - 1 - len(inner_shape))` if `inner_shape` is specified.
-
object
inner_shape - A tuple of integers specifying the shape for individual inner values in the returned `RaggedTensor`. Defaults to `()` if `ragged_rank` is not specified. If `ragged_rank` is specified, then a default is chosen based on the contents of `pylist`.
-
object
name - A name prefix for the returned tensor (optional).
-
ImplicitContainer<T>
row_splits_dtype - data type for the constructed `RaggedTensor`'s row_splits.
One of
tf.int32
ortf.int64
.
Returns
-
object
- A potentially ragged tensor with rank `K` and the specified `ragged_rank`, containing the values from `pylist`.
Show Example
>>> ragged.constant([[1, 2], [3], [4, 5, 6]]).eval() RaggedTensorValue(values=[1, 2, 3, 4, 5, 6], splits=[0, 2, 3, 6])
IList<object> constant_value(IEnumerable<object> pylist, PythonClassContainer dtype, Nullable<int> ragged_rank, object inner_shape, string row_splits_dtype)
Constructs a RaggedTensorValue from a nested Python list. Warning: This function returns a `RaggedTensorValue`, not a `RaggedTensor`.
If you wish to construct a constant `RaggedTensor`, use
[`ragged.constant(...)`](constant.md) instead. Example:
All scalar values in `pylist` must have the same nesting depth `K`, and the
returned `RaggedTensorValue` will have rank `K`. If `pylist` contains no
scalar values, then `K` is one greater than the maximum depth of empty lists
in `pylist`. All scalar values in `pylist` must be compatible with `dtype`.
Parameters
-
IEnumerable<object>
pylist - A nested `list`, `tuple` or `np.ndarray`. Any nested element that is not a `list` or `tuple` must be a scalar value compatible with `dtype`.
-
PythonClassContainer
dtype - `numpy.dtype`. The type of elements for the returned `RaggedTensor`. If not specified, then a default is chosen based on the scalar values in `pylist`.
-
Nullable<int>
ragged_rank - An integer specifying the ragged rank of the returned `RaggedTensorValue`. Must be nonnegative and less than `K`. Defaults to `max(0, K - 1)` if `inner_shape` is not specified. Defaults to `max(0, K - 1 - len(inner_shape))` if `inner_shape` is specified.
-
object
inner_shape - A tuple of integers specifying the shape for individual inner values in the returned `RaggedTensorValue`. Defaults to `()` if `ragged_rank` is not specified. If `ragged_rank` is specified, then a default is chosen based on the contents of `pylist`.
-
string
row_splits_dtype - data type for the constructed `RaggedTensorValue`'s row_splits. One of `numpy.int32` or `numpy.int64`.
Returns
-
IList<object>
- A `tf.RaggedTensorValue` or `numpy.array` with rank `K` and the specified `ragged_rank`, containing the values from `pylist`.
Show Example
>>> ragged.constant_value([[1, 2], [3], [4, 5, 6]]) RaggedTensorValue(values=[1, 2, 3, 4, 5, 6], splits=[0, 2, 3, 6])
IList<object> constant_value(IEnumerable<object> pylist, DType dtype, Nullable<int> ragged_rank, object inner_shape, PythonClassContainer row_splits_dtype)
Constructs a RaggedTensorValue from a nested Python list. Warning: This function returns a `RaggedTensorValue`, not a `RaggedTensor`.
If you wish to construct a constant `RaggedTensor`, use
[`ragged.constant(...)`](constant.md) instead. Example:
All scalar values in `pylist` must have the same nesting depth `K`, and the
returned `RaggedTensorValue` will have rank `K`. If `pylist` contains no
scalar values, then `K` is one greater than the maximum depth of empty lists
in `pylist`. All scalar values in `pylist` must be compatible with `dtype`.
Parameters
-
IEnumerable<object>
pylist - A nested `list`, `tuple` or `np.ndarray`. Any nested element that is not a `list` or `tuple` must be a scalar value compatible with `dtype`.
-
DType
dtype - `numpy.dtype`. The type of elements for the returned `RaggedTensor`. If not specified, then a default is chosen based on the scalar values in `pylist`.
-
Nullable<int>
ragged_rank - An integer specifying the ragged rank of the returned `RaggedTensorValue`. Must be nonnegative and less than `K`. Defaults to `max(0, K - 1)` if `inner_shape` is not specified. Defaults to `max(0, K - 1 - len(inner_shape))` if `inner_shape` is specified.
-
object
inner_shape - A tuple of integers specifying the shape for individual inner values in the returned `RaggedTensorValue`. Defaults to `()` if `ragged_rank` is not specified. If `ragged_rank` is specified, then a default is chosen based on the contents of `pylist`.
-
PythonClassContainer
row_splits_dtype - data type for the constructed `RaggedTensorValue`'s row_splits. One of `numpy.int32` or `numpy.int64`.
Returns
-
IList<object>
- A `tf.RaggedTensorValue` or `numpy.array` with rank `K` and the specified `ragged_rank`, containing the values from `pylist`.
Show Example
>>> ragged.constant_value([[1, 2], [3], [4, 5, 6]]) RaggedTensorValue(values=[1, 2, 3, 4, 5, 6], splits=[0, 2, 3, 6])
IList<object> constant_value(IEnumerable<object> pylist, dtype dtype, Nullable<int> ragged_rank, object inner_shape, PythonClassContainer row_splits_dtype)
Constructs a RaggedTensorValue from a nested Python list. Warning: This function returns a `RaggedTensorValue`, not a `RaggedTensor`.
If you wish to construct a constant `RaggedTensor`, use
[`ragged.constant(...)`](constant.md) instead. Example:
All scalar values in `pylist` must have the same nesting depth `K`, and the
returned `RaggedTensorValue` will have rank `K`. If `pylist` contains no
scalar values, then `K` is one greater than the maximum depth of empty lists
in `pylist`. All scalar values in `pylist` must be compatible with `dtype`.
Parameters
-
IEnumerable<object>
pylist - A nested `list`, `tuple` or `np.ndarray`. Any nested element that is not a `list` or `tuple` must be a scalar value compatible with `dtype`.
-
dtype
dtype - `numpy.dtype`. The type of elements for the returned `RaggedTensor`. If not specified, then a default is chosen based on the scalar values in `pylist`.
-
Nullable<int>
ragged_rank - An integer specifying the ragged rank of the returned `RaggedTensorValue`. Must be nonnegative and less than `K`. Defaults to `max(0, K - 1)` if `inner_shape` is not specified. Defaults to `max(0, K - 1 - len(inner_shape))` if `inner_shape` is specified.
-
object
inner_shape - A tuple of integers specifying the shape for individual inner values in the returned `RaggedTensorValue`. Defaults to `()` if `ragged_rank` is not specified. If `ragged_rank` is specified, then a default is chosen based on the contents of `pylist`.
-
PythonClassContainer
row_splits_dtype - data type for the constructed `RaggedTensorValue`'s row_splits. One of `numpy.int32` or `numpy.int64`.
Returns
-
IList<object>
- A `tf.RaggedTensorValue` or `numpy.array` with rank `K` and the specified `ragged_rank`, containing the values from `pylist`.
Show Example
>>> ragged.constant_value([[1, 2], [3], [4, 5, 6]]) RaggedTensorValue(values=[1, 2, 3, 4, 5, 6], splits=[0, 2, 3, 6])
IList<object> constant_value(IEnumerable<object> pylist, DType dtype, Nullable<int> ragged_rank, object inner_shape, string row_splits_dtype)
Constructs a RaggedTensorValue from a nested Python list. Warning: This function returns a `RaggedTensorValue`, not a `RaggedTensor`.
If you wish to construct a constant `RaggedTensor`, use
[`ragged.constant(...)`](constant.md) instead. Example:
All scalar values in `pylist` must have the same nesting depth `K`, and the
returned `RaggedTensorValue` will have rank `K`. If `pylist` contains no
scalar values, then `K` is one greater than the maximum depth of empty lists
in `pylist`. All scalar values in `pylist` must be compatible with `dtype`.
Parameters
-
IEnumerable<object>
pylist - A nested `list`, `tuple` or `np.ndarray`. Any nested element that is not a `list` or `tuple` must be a scalar value compatible with `dtype`.
-
DType
dtype - `numpy.dtype`. The type of elements for the returned `RaggedTensor`. If not specified, then a default is chosen based on the scalar values in `pylist`.
-
Nullable<int>
ragged_rank - An integer specifying the ragged rank of the returned `RaggedTensorValue`. Must be nonnegative and less than `K`. Defaults to `max(0, K - 1)` if `inner_shape` is not specified. Defaults to `max(0, K - 1 - len(inner_shape))` if `inner_shape` is specified.
-
object
inner_shape - A tuple of integers specifying the shape for individual inner values in the returned `RaggedTensorValue`. Defaults to `()` if `ragged_rank` is not specified. If `ragged_rank` is specified, then a default is chosen based on the contents of `pylist`.
-
string
row_splits_dtype - data type for the constructed `RaggedTensorValue`'s row_splits. One of `numpy.int32` or `numpy.int64`.
Returns
-
IList<object>
- A `tf.RaggedTensorValue` or `numpy.array` with rank `K` and the specified `ragged_rank`, containing the values from `pylist`.
Show Example
>>> ragged.constant_value([[1, 2], [3], [4, 5, 6]]) RaggedTensorValue(values=[1, 2, 3, 4, 5, 6], splits=[0, 2, 3, 6])
IList<object> constant_value(IEnumerable<object> pylist, PythonClassContainer dtype, Nullable<int> ragged_rank, object inner_shape, dtype row_splits_dtype)
Constructs a RaggedTensorValue from a nested Python list. Warning: This function returns a `RaggedTensorValue`, not a `RaggedTensor`.
If you wish to construct a constant `RaggedTensor`, use
[`ragged.constant(...)`](constant.md) instead. Example:
All scalar values in `pylist` must have the same nesting depth `K`, and the
returned `RaggedTensorValue` will have rank `K`. If `pylist` contains no
scalar values, then `K` is one greater than the maximum depth of empty lists
in `pylist`. All scalar values in `pylist` must be compatible with `dtype`.
Parameters
-
IEnumerable<object>
pylist - A nested `list`, `tuple` or `np.ndarray`. Any nested element that is not a `list` or `tuple` must be a scalar value compatible with `dtype`.
-
PythonClassContainer
dtype - `numpy.dtype`. The type of elements for the returned `RaggedTensor`. If not specified, then a default is chosen based on the scalar values in `pylist`.
-
Nullable<int>
ragged_rank - An integer specifying the ragged rank of the returned `RaggedTensorValue`. Must be nonnegative and less than `K`. Defaults to `max(0, K - 1)` if `inner_shape` is not specified. Defaults to `max(0, K - 1 - len(inner_shape))` if `inner_shape` is specified.
-
object
inner_shape - A tuple of integers specifying the shape for individual inner values in the returned `RaggedTensorValue`. Defaults to `()` if `ragged_rank` is not specified. If `ragged_rank` is specified, then a default is chosen based on the contents of `pylist`.
-
dtype
row_splits_dtype - data type for the constructed `RaggedTensorValue`'s row_splits. One of `numpy.int32` or `numpy.int64`.
Returns
-
IList<object>
- A `tf.RaggedTensorValue` or `numpy.array` with rank `K` and the specified `ragged_rank`, containing the values from `pylist`.
Show Example
>>> ragged.constant_value([[1, 2], [3], [4, 5, 6]]) RaggedTensorValue(values=[1, 2, 3, 4, 5, 6], splits=[0, 2, 3, 6])
IList<object> constant_value(IEnumerable<object> pylist, dtype dtype, Nullable<int> ragged_rank, object inner_shape, dtype row_splits_dtype)
Constructs a RaggedTensorValue from a nested Python list. Warning: This function returns a `RaggedTensorValue`, not a `RaggedTensor`.
If you wish to construct a constant `RaggedTensor`, use
[`ragged.constant(...)`](constant.md) instead. Example:
All scalar values in `pylist` must have the same nesting depth `K`, and the
returned `RaggedTensorValue` will have rank `K`. If `pylist` contains no
scalar values, then `K` is one greater than the maximum depth of empty lists
in `pylist`. All scalar values in `pylist` must be compatible with `dtype`.
Parameters
-
IEnumerable<object>
pylist - A nested `list`, `tuple` or `np.ndarray`. Any nested element that is not a `list` or `tuple` must be a scalar value compatible with `dtype`.
-
dtype
dtype - `numpy.dtype`. The type of elements for the returned `RaggedTensor`. If not specified, then a default is chosen based on the scalar values in `pylist`.
-
Nullable<int>
ragged_rank - An integer specifying the ragged rank of the returned `RaggedTensorValue`. Must be nonnegative and less than `K`. Defaults to `max(0, K - 1)` if `inner_shape` is not specified. Defaults to `max(0, K - 1 - len(inner_shape))` if `inner_shape` is specified.
-
object
inner_shape - A tuple of integers specifying the shape for individual inner values in the returned `RaggedTensorValue`. Defaults to `()` if `ragged_rank` is not specified. If `ragged_rank` is specified, then a default is chosen based on the contents of `pylist`.
-
dtype
row_splits_dtype - data type for the constructed `RaggedTensorValue`'s row_splits. One of `numpy.int32` or `numpy.int64`.
Returns
-
IList<object>
- A `tf.RaggedTensorValue` or `numpy.array` with rank `K` and the specified `ragged_rank`, containing the values from `pylist`.
Show Example
>>> ragged.constant_value([[1, 2], [3], [4, 5, 6]]) RaggedTensorValue(values=[1, 2, 3, 4, 5, 6], splits=[0, 2, 3, 6])
IList<object> constant_value(IEnumerable<object> pylist, PythonClassContainer dtype, Nullable<int> ragged_rank, object inner_shape, PythonClassContainer row_splits_dtype)
Constructs a RaggedTensorValue from a nested Python list. Warning: This function returns a `RaggedTensorValue`, not a `RaggedTensor`.
If you wish to construct a constant `RaggedTensor`, use
[`ragged.constant(...)`](constant.md) instead. Example:
All scalar values in `pylist` must have the same nesting depth `K`, and the
returned `RaggedTensorValue` will have rank `K`. If `pylist` contains no
scalar values, then `K` is one greater than the maximum depth of empty lists
in `pylist`. All scalar values in `pylist` must be compatible with `dtype`.
Parameters
-
IEnumerable<object>
pylist - A nested `list`, `tuple` or `np.ndarray`. Any nested element that is not a `list` or `tuple` must be a scalar value compatible with `dtype`.
-
PythonClassContainer
dtype - `numpy.dtype`. The type of elements for the returned `RaggedTensor`. If not specified, then a default is chosen based on the scalar values in `pylist`.
-
Nullable<int>
ragged_rank - An integer specifying the ragged rank of the returned `RaggedTensorValue`. Must be nonnegative and less than `K`. Defaults to `max(0, K - 1)` if `inner_shape` is not specified. Defaults to `max(0, K - 1 - len(inner_shape))` if `inner_shape` is specified.
-
object
inner_shape - A tuple of integers specifying the shape for individual inner values in the returned `RaggedTensorValue`. Defaults to `()` if `ragged_rank` is not specified. If `ragged_rank` is specified, then a default is chosen based on the contents of `pylist`.
-
PythonClassContainer
row_splits_dtype - data type for the constructed `RaggedTensorValue`'s row_splits. One of `numpy.int32` or `numpy.int64`.
Returns
-
IList<object>
- A `tf.RaggedTensorValue` or `numpy.array` with rank `K` and the specified `ragged_rank`, containing the values from `pylist`.
Show Example
>>> ragged.constant_value([[1, 2], [3], [4, 5, 6]]) RaggedTensorValue(values=[1, 2, 3, 4, 5, 6], splits=[0, 2, 3, 6])
IList<object> constant_value(IEnumerable<object> pylist, DType dtype, Nullable<int> ragged_rank, object inner_shape, dtype row_splits_dtype)
Constructs a RaggedTensorValue from a nested Python list. Warning: This function returns a `RaggedTensorValue`, not a `RaggedTensor`.
If you wish to construct a constant `RaggedTensor`, use
[`ragged.constant(...)`](constant.md) instead. Example:
All scalar values in `pylist` must have the same nesting depth `K`, and the
returned `RaggedTensorValue` will have rank `K`. If `pylist` contains no
scalar values, then `K` is one greater than the maximum depth of empty lists
in `pylist`. All scalar values in `pylist` must be compatible with `dtype`.
Parameters
-
IEnumerable<object>
pylist - A nested `list`, `tuple` or `np.ndarray`. Any nested element that is not a `list` or `tuple` must be a scalar value compatible with `dtype`.
-
DType
dtype - `numpy.dtype`. The type of elements for the returned `RaggedTensor`. If not specified, then a default is chosen based on the scalar values in `pylist`.
-
Nullable<int>
ragged_rank - An integer specifying the ragged rank of the returned `RaggedTensorValue`. Must be nonnegative and less than `K`. Defaults to `max(0, K - 1)` if `inner_shape` is not specified. Defaults to `max(0, K - 1 - len(inner_shape))` if `inner_shape` is specified.
-
object
inner_shape - A tuple of integers specifying the shape for individual inner values in the returned `RaggedTensorValue`. Defaults to `()` if `ragged_rank` is not specified. If `ragged_rank` is specified, then a default is chosen based on the contents of `pylist`.
-
dtype
row_splits_dtype - data type for the constructed `RaggedTensorValue`'s row_splits. One of `numpy.int32` or `numpy.int64`.
Returns
-
IList<object>
- A `tf.RaggedTensorValue` or `numpy.array` with rank `K` and the specified `ragged_rank`, containing the values from `pylist`.
Show Example
>>> ragged.constant_value([[1, 2], [3], [4, 5, 6]]) RaggedTensorValue(values=[1, 2, 3, 4, 5, 6], splits=[0, 2, 3, 6])
IList<object> constant_value(IEnumerable<object> pylist, Byte[] dtype, Nullable<int> ragged_rank, object inner_shape, string row_splits_dtype)
Constructs a RaggedTensorValue from a nested Python list. Warning: This function returns a `RaggedTensorValue`, not a `RaggedTensor`.
If you wish to construct a constant `RaggedTensor`, use
[`ragged.constant(...)`](constant.md) instead. Example:
All scalar values in `pylist` must have the same nesting depth `K`, and the
returned `RaggedTensorValue` will have rank `K`. If `pylist` contains no
scalar values, then `K` is one greater than the maximum depth of empty lists
in `pylist`. All scalar values in `pylist` must be compatible with `dtype`.
Parameters
-
IEnumerable<object>
pylist - A nested `list`, `tuple` or `np.ndarray`. Any nested element that is not a `list` or `tuple` must be a scalar value compatible with `dtype`.
-
Byte[]
dtype - `numpy.dtype`. The type of elements for the returned `RaggedTensor`. If not specified, then a default is chosen based on the scalar values in `pylist`.
-
Nullable<int>
ragged_rank - An integer specifying the ragged rank of the returned `RaggedTensorValue`. Must be nonnegative and less than `K`. Defaults to `max(0, K - 1)` if `inner_shape` is not specified. Defaults to `max(0, K - 1 - len(inner_shape))` if `inner_shape` is specified.
-
object
inner_shape - A tuple of integers specifying the shape for individual inner values in the returned `RaggedTensorValue`. Defaults to `()` if `ragged_rank` is not specified. If `ragged_rank` is specified, then a default is chosen based on the contents of `pylist`.
-
string
row_splits_dtype - data type for the constructed `RaggedTensorValue`'s row_splits. One of `numpy.int32` or `numpy.int64`.
Returns
-
IList<object>
- A `tf.RaggedTensorValue` or `numpy.array` with rank `K` and the specified `ragged_rank`, containing the values from `pylist`.
Show Example
>>> ragged.constant_value([[1, 2], [3], [4, 5, 6]]) RaggedTensorValue(values=[1, 2, 3, 4, 5, 6], splits=[0, 2, 3, 6])
IList<object> constant_value(IEnumerable<object> pylist, Byte[] dtype, Nullable<int> ragged_rank, object inner_shape, PythonClassContainer row_splits_dtype)
Constructs a RaggedTensorValue from a nested Python list. Warning: This function returns a `RaggedTensorValue`, not a `RaggedTensor`.
If you wish to construct a constant `RaggedTensor`, use
[`ragged.constant(...)`](constant.md) instead. Example:
All scalar values in `pylist` must have the same nesting depth `K`, and the
returned `RaggedTensorValue` will have rank `K`. If `pylist` contains no
scalar values, then `K` is one greater than the maximum depth of empty lists
in `pylist`. All scalar values in `pylist` must be compatible with `dtype`.
Parameters
-
IEnumerable<object>
pylist - A nested `list`, `tuple` or `np.ndarray`. Any nested element that is not a `list` or `tuple` must be a scalar value compatible with `dtype`.
-
Byte[]
dtype - `numpy.dtype`. The type of elements for the returned `RaggedTensor`. If not specified, then a default is chosen based on the scalar values in `pylist`.
-
Nullable<int>
ragged_rank - An integer specifying the ragged rank of the returned `RaggedTensorValue`. Must be nonnegative and less than `K`. Defaults to `max(0, K - 1)` if `inner_shape` is not specified. Defaults to `max(0, K - 1 - len(inner_shape))` if `inner_shape` is specified.
-
object
inner_shape - A tuple of integers specifying the shape for individual inner values in the returned `RaggedTensorValue`. Defaults to `()` if `ragged_rank` is not specified. If `ragged_rank` is specified, then a default is chosen based on the contents of `pylist`.
-
PythonClassContainer
row_splits_dtype - data type for the constructed `RaggedTensorValue`'s row_splits. One of `numpy.int32` or `numpy.int64`.
Returns
-
IList<object>
- A `tf.RaggedTensorValue` or `numpy.array` with rank `K` and the specified `ragged_rank`, containing the values from `pylist`.
Show Example
>>> ragged.constant_value([[1, 2], [3], [4, 5, 6]]) RaggedTensorValue(values=[1, 2, 3, 4, 5, 6], splits=[0, 2, 3, 6])
IList<object> constant_value(IEnumerable<object> pylist, Byte[] dtype, Nullable<int> ragged_rank, object inner_shape, dtype row_splits_dtype)
Constructs a RaggedTensorValue from a nested Python list. Warning: This function returns a `RaggedTensorValue`, not a `RaggedTensor`.
If you wish to construct a constant `RaggedTensor`, use
[`ragged.constant(...)`](constant.md) instead. Example:
All scalar values in `pylist` must have the same nesting depth `K`, and the
returned `RaggedTensorValue` will have rank `K`. If `pylist` contains no
scalar values, then `K` is one greater than the maximum depth of empty lists
in `pylist`. All scalar values in `pylist` must be compatible with `dtype`.
Parameters
-
IEnumerable<object>
pylist - A nested `list`, `tuple` or `np.ndarray`. Any nested element that is not a `list` or `tuple` must be a scalar value compatible with `dtype`.
-
Byte[]
dtype - `numpy.dtype`. The type of elements for the returned `RaggedTensor`. If not specified, then a default is chosen based on the scalar values in `pylist`.
-
Nullable<int>
ragged_rank - An integer specifying the ragged rank of the returned `RaggedTensorValue`. Must be nonnegative and less than `K`. Defaults to `max(0, K - 1)` if `inner_shape` is not specified. Defaults to `max(0, K - 1 - len(inner_shape))` if `inner_shape` is specified.
-
object
inner_shape - A tuple of integers specifying the shape for individual inner values in the returned `RaggedTensorValue`. Defaults to `()` if `ragged_rank` is not specified. If `ragged_rank` is specified, then a default is chosen based on the contents of `pylist`.
-
dtype
row_splits_dtype - data type for the constructed `RaggedTensorValue`'s row_splits. One of `numpy.int32` or `numpy.int64`.
Returns
-
IList<object>
- A `tf.RaggedTensorValue` or `numpy.array` with rank `K` and the specified `ragged_rank`, containing the values from `pylist`.
Show Example
>>> ragged.constant_value([[1, 2], [3], [4, 5, 6]]) RaggedTensorValue(values=[1, 2, 3, 4, 5, 6], splits=[0, 2, 3, 6])
IList<object> constant_value(IEnumerable<object> pylist, dtype dtype, Nullable<int> ragged_rank, object inner_shape, string row_splits_dtype)
Constructs a RaggedTensorValue from a nested Python list. Warning: This function returns a `RaggedTensorValue`, not a `RaggedTensor`.
If you wish to construct a constant `RaggedTensor`, use
[`ragged.constant(...)`](constant.md) instead. Example:
All scalar values in `pylist` must have the same nesting depth `K`, and the
returned `RaggedTensorValue` will have rank `K`. If `pylist` contains no
scalar values, then `K` is one greater than the maximum depth of empty lists
in `pylist`. All scalar values in `pylist` must be compatible with `dtype`.
Parameters
-
IEnumerable<object>
pylist - A nested `list`, `tuple` or `np.ndarray`. Any nested element that is not a `list` or `tuple` must be a scalar value compatible with `dtype`.
-
dtype
dtype - `numpy.dtype`. The type of elements for the returned `RaggedTensor`. If not specified, then a default is chosen based on the scalar values in `pylist`.
-
Nullable<int>
ragged_rank - An integer specifying the ragged rank of the returned `RaggedTensorValue`. Must be nonnegative and less than `K`. Defaults to `max(0, K - 1)` if `inner_shape` is not specified. Defaults to `max(0, K - 1 - len(inner_shape))` if `inner_shape` is specified.
-
object
inner_shape - A tuple of integers specifying the shape for individual inner values in the returned `RaggedTensorValue`. Defaults to `()` if `ragged_rank` is not specified. If `ragged_rank` is specified, then a default is chosen based on the contents of `pylist`.
-
string
row_splits_dtype - data type for the constructed `RaggedTensorValue`'s row_splits. One of `numpy.int32` or `numpy.int64`.
Returns
-
IList<object>
- A `tf.RaggedTensorValue` or `numpy.array` with rank `K` and the specified `ragged_rank`, containing the values from `pylist`.
Show Example
>>> ragged.constant_value([[1, 2], [3], [4, 5, 6]]) RaggedTensorValue(values=[1, 2, 3, 4, 5, 6], splits=[0, 2, 3, 6])
object constant_value_dyn(object pylist, object dtype, object ragged_rank, object inner_shape, ImplicitContainer<T> row_splits_dtype)
Constructs a RaggedTensorValue from a nested Python list. Warning: This function returns a `RaggedTensorValue`, not a `RaggedTensor`.
If you wish to construct a constant `RaggedTensor`, use
[`ragged.constant(...)`](constant.md) instead. Example:
All scalar values in `pylist` must have the same nesting depth `K`, and the
returned `RaggedTensorValue` will have rank `K`. If `pylist` contains no
scalar values, then `K` is one greater than the maximum depth of empty lists
in `pylist`. All scalar values in `pylist` must be compatible with `dtype`.
Parameters
-
object
pylist - A nested `list`, `tuple` or `np.ndarray`. Any nested element that is not a `list` or `tuple` must be a scalar value compatible with `dtype`.
-
object
dtype - `numpy.dtype`. The type of elements for the returned `RaggedTensor`. If not specified, then a default is chosen based on the scalar values in `pylist`.
-
object
ragged_rank - An integer specifying the ragged rank of the returned `RaggedTensorValue`. Must be nonnegative and less than `K`. Defaults to `max(0, K - 1)` if `inner_shape` is not specified. Defaults to `max(0, K - 1 - len(inner_shape))` if `inner_shape` is specified.
-
object
inner_shape - A tuple of integers specifying the shape for individual inner values in the returned `RaggedTensorValue`. Defaults to `()` if `ragged_rank` is not specified. If `ragged_rank` is specified, then a default is chosen based on the contents of `pylist`.
-
ImplicitContainer<T>
row_splits_dtype - data type for the constructed `RaggedTensorValue`'s row_splits. One of `numpy.int32` or `numpy.int64`.
Returns
-
object
- A `tf.RaggedTensorValue` or `numpy.array` with rank `K` and the specified `ragged_rank`, containing the values from `pylist`.
Show Example
>>> ragged.constant_value([[1, 2], [3], [4, 5, 6]]) RaggedTensorValue(values=[1, 2, 3, 4, 5, 6], splits=[0, 2, 3, 6])
RaggedTensor map_flat_values(PythonFunctionContainer op, Object[] args)
Applies `op` to the values of one or more RaggedTensors. Replaces any `RaggedTensor` in `args` or `kwargs` with its `flat_values`
tensor, and then calls `op`. Returns a `RaggedTensor` that is constructed
from the input `RaggedTensor`s' `nested_row_splits` and the value returned by
the `op`. If the input arguments contain multiple `RaggedTensor`s, then they must have
identical `nested_row_splits`. Examples:
Parameters
-
PythonFunctionContainer
op - The operation that should be applied to the RaggedTensor `flat_values`. `op` is typically an element-wise operation (such as math_ops.add), but any operation that preserves the size of the outermost dimension can be used. I.e., `shape[0]` of the value returned by `op` must match `shape[0]` of the `RaggedTensor`s' `flat_values` tensors.
-
Object[]
args - Arguments for `op`.
Returns
-
RaggedTensor
- A `RaggedTensor` whose `ragged_rank` matches the `ragged_rank` of all input `RaggedTensor`s.
Show Example
>>> rt = ragged.constant([[1, 2, 3], [], [4, 5], [6]]) >>> ragged.map_flat_values(tf.ones_like, rt).eval().tolist() [[1, 1, 1], [], [1, 1], [1]] >>> ragged.map_flat_values(tf.multiply, rt, rt).eval().tolist() [[1, 4, 9], [], [16, 25], [36]] >>> ragged.map_flat_values(tf.add, rt, 5).eval().tolist() [[6, 7, 8], [], [9, 10], [11]]
RaggedTensor map_flat_values(PythonFunctionContainer op, IDictionary<string, object> kwargs, Object[] args)
Applies `op` to the values of one or more RaggedTensors. Replaces any `RaggedTensor` in `args` or `kwargs` with its `flat_values`
tensor, and then calls `op`. Returns a `RaggedTensor` that is constructed
from the input `RaggedTensor`s' `nested_row_splits` and the value returned by
the `op`. If the input arguments contain multiple `RaggedTensor`s, then they must have
identical `nested_row_splits`. Examples:
Parameters
-
PythonFunctionContainer
op - The operation that should be applied to the RaggedTensor `flat_values`. `op` is typically an element-wise operation (such as math_ops.add), but any operation that preserves the size of the outermost dimension can be used. I.e., `shape[0]` of the value returned by `op` must match `shape[0]` of the `RaggedTensor`s' `flat_values` tensors.
-
IDictionary<string, object>
kwargs - Keyword arguments for `op`.
-
Object[]
args - Arguments for `op`.
Returns
-
RaggedTensor
- A `RaggedTensor` whose `ragged_rank` matches the `ragged_rank` of all input `RaggedTensor`s.
Show Example
>>> rt = ragged.constant([[1, 2, 3], [], [4, 5], [6]]) >>> ragged.map_flat_values(tf.ones_like, rt).eval().tolist() [[1, 1, 1], [], [1, 1], [1]] >>> ragged.map_flat_values(tf.multiply, rt, rt).eval().tolist() [[1, 4, 9], [], [16, 25], [36]] >>> ragged.map_flat_values(tf.add, rt, 5).eval().tolist() [[6, 7, 8], [], [9, 10], [11]]
object map_flat_values_dyn(object op, IDictionary<string, object> kwargs, Object[] args)
Applies `op` to the values of one or more RaggedTensors. Replaces any `RaggedTensor` in `args` or `kwargs` with its `flat_values`
tensor, and then calls `op`. Returns a `RaggedTensor` that is constructed
from the input `RaggedTensor`s' `nested_row_splits` and the value returned by
the `op`. If the input arguments contain multiple `RaggedTensor`s, then they must have
identical `nested_row_splits`. Examples:
Parameters
-
object
op - The operation that should be applied to the RaggedTensor `flat_values`. `op` is typically an element-wise operation (such as math_ops.add), but any operation that preserves the size of the outermost dimension can be used. I.e., `shape[0]` of the value returned by `op` must match `shape[0]` of the `RaggedTensor`s' `flat_values` tensors.
-
IDictionary<string, object>
kwargs - Keyword arguments for `op`.
-
Object[]
args - Arguments for `op`.
Returns
-
object
- A `RaggedTensor` whose `ragged_rank` matches the `ragged_rank` of all input `RaggedTensor`s.
Show Example
>>> rt = ragged.constant([[1, 2, 3], [], [4, 5], [6]]) >>> ragged.map_flat_values(tf.ones_like, rt).eval().tolist() [[1, 1, 1], [], [1, 1], [1]] >>> ragged.map_flat_values(tf.multiply, rt, rt).eval().tolist() [[1, 4, 9], [], [16, 25], [36]] >>> ragged.map_flat_values(tf.add, rt, 5).eval().tolist() [[6, 7, 8], [], [9, 10], [11]]
object map_flat_values_dyn(object op, Object[] args)
Applies `op` to the values of one or more RaggedTensors. Replaces any `RaggedTensor` in `args` or `kwargs` with its `flat_values`
tensor, and then calls `op`. Returns a `RaggedTensor` that is constructed
from the input `RaggedTensor`s' `nested_row_splits` and the value returned by
the `op`. If the input arguments contain multiple `RaggedTensor`s, then they must have
identical `nested_row_splits`. Examples:
Parameters
-
object
op - The operation that should be applied to the RaggedTensor `flat_values`. `op` is typically an element-wise operation (such as math_ops.add), but any operation that preserves the size of the outermost dimension can be used. I.e., `shape[0]` of the value returned by `op` must match `shape[0]` of the `RaggedTensor`s' `flat_values` tensors.
-
Object[]
args - Arguments for `op`.
Returns
-
object
- A `RaggedTensor` whose `ragged_rank` matches the `ragged_rank` of all input `RaggedTensor`s.
Show Example
>>> rt = ragged.constant([[1, 2, 3], [], [4, 5], [6]]) >>> ragged.map_flat_values(tf.ones_like, rt).eval().tolist() [[1, 1, 1], [], [1, 1], [1]] >>> ragged.map_flat_values(tf.multiply, rt, rt).eval().tolist() [[1, 4, 9], [], [16, 25], [36]] >>> ragged.map_flat_values(tf.add, rt, 5).eval().tolist() [[6, 7, 8], [], [9, 10], [11]]
object placeholder(DType dtype, int ragged_rank, IEnumerable<object> value_shape, string name)
Creates a placeholder for a
tf.RaggedTensor
that will always be fed. **Important**: This ragged tensor will produce an error if evaluated.
Its value must be fed using the `feed_dict` optional argument to
`Session.run()`, `Tensor.eval()`, or `Operation.run()`. @compatibility{eager} Placeholders are not compatible with eager execution.
Parameters
-
DType
dtype - The data type for the `RaggedTensor`.
-
int
ragged_rank - The ragged rank for the `RaggedTensor`
-
IEnumerable<object>
value_shape - The shape for individual flat values in the `RaggedTensor`.
-
string
name - A name for the operation (optional).
Returns
-
object
- A `RaggedTensor` that may be used as a handle for feeding a value, but not evaluated directly.
object placeholder(PythonClassContainer dtype, int ragged_rank, object value_shape, string name)
Creates a placeholder for a
tf.RaggedTensor
that will always be fed. **Important**: This ragged tensor will produce an error if evaluated.
Its value must be fed using the `feed_dict` optional argument to
`Session.run()`, `Tensor.eval()`, or `Operation.run()`. @compatibility{eager} Placeholders are not compatible with eager execution.
Parameters
-
PythonClassContainer
dtype - The data type for the `RaggedTensor`.
-
int
ragged_rank - The ragged rank for the `RaggedTensor`
-
object
value_shape - The shape for individual flat values in the `RaggedTensor`.
-
string
name - A name for the operation (optional).
Returns
-
object
- A `RaggedTensor` that may be used as a handle for feeding a value, but not evaluated directly.
object placeholder(PythonClassContainer dtype, int ragged_rank, ValueTuple<int, object, int> value_shape, string name)
Creates a placeholder for a
tf.RaggedTensor
that will always be fed. **Important**: This ragged tensor will produce an error if evaluated.
Its value must be fed using the `feed_dict` optional argument to
`Session.run()`, `Tensor.eval()`, or `Operation.run()`. @compatibility{eager} Placeholders are not compatible with eager execution.
Parameters
-
PythonClassContainer
dtype - The data type for the `RaggedTensor`.
-
int
ragged_rank - The ragged rank for the `RaggedTensor`
-
ValueTuple<int, object, int>
value_shape - The shape for individual flat values in the `RaggedTensor`.
-
string
name - A name for the operation (optional).
Returns
-
object
- A `RaggedTensor` that may be used as a handle for feeding a value, but not evaluated directly.
object placeholder(PythonClassContainer dtype, int ragged_rank, IEnumerable<object> value_shape, string name)
Creates a placeholder for a
tf.RaggedTensor
that will always be fed. **Important**: This ragged tensor will produce an error if evaluated.
Its value must be fed using the `feed_dict` optional argument to
`Session.run()`, `Tensor.eval()`, or `Operation.run()`. @compatibility{eager} Placeholders are not compatible with eager execution.
Parameters
-
PythonClassContainer
dtype - The data type for the `RaggedTensor`.
-
int
ragged_rank - The ragged rank for the `RaggedTensor`
-
IEnumerable<object>
value_shape - The shape for individual flat values in the `RaggedTensor`.
-
string
name - A name for the operation (optional).
Returns
-
object
- A `RaggedTensor` that may be used as a handle for feeding a value, but not evaluated directly.
object placeholder(DType dtype, int ragged_rank, object value_shape, string name)
Creates a placeholder for a
tf.RaggedTensor
that will always be fed. **Important**: This ragged tensor will produce an error if evaluated.
Its value must be fed using the `feed_dict` optional argument to
`Session.run()`, `Tensor.eval()`, or `Operation.run()`. @compatibility{eager} Placeholders are not compatible with eager execution.
Parameters
-
DType
dtype - The data type for the `RaggedTensor`.
-
int
ragged_rank - The ragged rank for the `RaggedTensor`
-
object
value_shape - The shape for individual flat values in the `RaggedTensor`.
-
string
name - A name for the operation (optional).
Returns
-
object
- A `RaggedTensor` that may be used as a handle for feeding a value, but not evaluated directly.
object placeholder(DType dtype, int ragged_rank, ValueTuple<int, object, int> value_shape, string name)
Creates a placeholder for a
tf.RaggedTensor
that will always be fed. **Important**: This ragged tensor will produce an error if evaluated.
Its value must be fed using the `feed_dict` optional argument to
`Session.run()`, `Tensor.eval()`, or `Operation.run()`. @compatibility{eager} Placeholders are not compatible with eager execution.
Parameters
-
DType
dtype - The data type for the `RaggedTensor`.
-
int
ragged_rank - The ragged rank for the `RaggedTensor`
-
ValueTuple<int, object, int>
value_shape - The shape for individual flat values in the `RaggedTensor`.
-
string
name - A name for the operation (optional).
Returns
-
object
- A `RaggedTensor` that may be used as a handle for feeding a value, but not evaluated directly.
object placeholder(dtype dtype, int ragged_rank, IEnumerable<object> value_shape, string name)
Creates a placeholder for a
tf.RaggedTensor
that will always be fed. **Important**: This ragged tensor will produce an error if evaluated.
Its value must be fed using the `feed_dict` optional argument to
`Session.run()`, `Tensor.eval()`, or `Operation.run()`. @compatibility{eager} Placeholders are not compatible with eager execution.
Parameters
-
dtype
dtype - The data type for the `RaggedTensor`.
-
int
ragged_rank - The ragged rank for the `RaggedTensor`
-
IEnumerable<object>
value_shape - The shape for individual flat values in the `RaggedTensor`.
-
string
name - A name for the operation (optional).
Returns
-
object
- A `RaggedTensor` that may be used as a handle for feeding a value, but not evaluated directly.
object placeholder(dtype dtype, int ragged_rank, ValueTuple<int, object, int> value_shape, string name)
Creates a placeholder for a
tf.RaggedTensor
that will always be fed. **Important**: This ragged tensor will produce an error if evaluated.
Its value must be fed using the `feed_dict` optional argument to
`Session.run()`, `Tensor.eval()`, or `Operation.run()`. @compatibility{eager} Placeholders are not compatible with eager execution.
Parameters
-
dtype
dtype - The data type for the `RaggedTensor`.
-
int
ragged_rank - The ragged rank for the `RaggedTensor`
-
ValueTuple<int, object, int>
value_shape - The shape for individual flat values in the `RaggedTensor`.
-
string
name - A name for the operation (optional).
Returns
-
object
- A `RaggedTensor` that may be used as a handle for feeding a value, but not evaluated directly.
object placeholder(dtype dtype, int ragged_rank, object value_shape, string name)
Creates a placeholder for a
tf.RaggedTensor
that will always be fed. **Important**: This ragged tensor will produce an error if evaluated.
Its value must be fed using the `feed_dict` optional argument to
`Session.run()`, `Tensor.eval()`, or `Operation.run()`. @compatibility{eager} Placeholders are not compatible with eager execution.
Parameters
-
dtype
dtype - The data type for the `RaggedTensor`.
-
int
ragged_rank - The ragged rank for the `RaggedTensor`
-
object
value_shape - The shape for individual flat values in the `RaggedTensor`.
-
string
name - A name for the operation (optional).
Returns
-
object
- A `RaggedTensor` that may be used as a handle for feeding a value, but not evaluated directly.
object placeholder_dyn(object dtype, object ragged_rank, object value_shape, object name)
Creates a placeholder for a
tf.RaggedTensor
that will always be fed. **Important**: This ragged tensor will produce an error if evaluated.
Its value must be fed using the `feed_dict` optional argument to
`Session.run()`, `Tensor.eval()`, or `Operation.run()`. @compatibility{eager} Placeholders are not compatible with eager execution.
Parameters
-
object
dtype - The data type for the `RaggedTensor`.
-
object
ragged_rank - The ragged rank for the `RaggedTensor`
-
object
value_shape - The shape for individual flat values in the `RaggedTensor`.
-
object
name - A name for the operation (optional).
Returns
-
object
- A `RaggedTensor` that may be used as a handle for feeding a value, but not evaluated directly.
RaggedTensor range(IEnumerable<int> starts, ValueTuple<IEnumerable<object>, object> limits, ImplicitContainer<T> deltas, DType dtype, string name, ImplicitContainer<T> row_splits_dtype)
Returns a `RaggedTensor` containing the specified sequences of numbers. Each row of the returned `RaggedTensor` contains a single sequence:
If `start[i] < limits[i] and deltas[i] > 0`, then `output[i]` will be an
empty list. Similarly, if `start[i] > limits[i] and deltas[i] < 0`, then
`output[i]` will be an empty list. This behavior is consistent with the
Python `range` function, but differs from the
tf.range
op, which returns
an error for these cases. Examples:
The input tensors `starts`, `limits`, and `deltas` may be scalars or vectors.
The vector inputs must all have the same size. Scalar inputs are broadcast
to match the size of the vector inputs.
Parameters
-
IEnumerable<int>
starts - Vector or scalar `Tensor`. Specifies the first entry for each range if `limits` is not `None`; otherwise, specifies the range limits, and the first entries default to `0`.
-
ValueTuple<IEnumerable<object>, object>
limits - Vector or scalar `Tensor`. Specifies the exclusive upper limits for each range.
-
ImplicitContainer<T>
deltas - Vector or scalar `Tensor`. Specifies the increment for each range. Defaults to `1`.
-
DType
dtype - The type of the elements of the resulting tensor. If not specified, then a value is chosen based on the other args.
-
string
name - A name for the operation.
-
ImplicitContainer<T>
row_splits_dtype - `dtype` for the returned `RaggedTensor`'s `row_splits`
tensor. One of
tf.int32
ortf.int64
.
Returns
-
RaggedTensor
- A `RaggedTensor` of type `dtype` with `ragged_rank=1`.
Show Example
ragged.range(starts, limits, deltas)[i] == tf.range(starts[i], limits[i], deltas[i])
RaggedTensor range(IEnumerable<int> starts, int limits, ImplicitContainer<T> deltas, DType dtype, string name, ImplicitContainer<T> row_splits_dtype)
Returns a `RaggedTensor` containing the specified sequences of numbers. Each row of the returned `RaggedTensor` contains a single sequence:
If `start[i] < limits[i] and deltas[i] > 0`, then `output[i]` will be an
empty list. Similarly, if `start[i] > limits[i] and deltas[i] < 0`, then
`output[i]` will be an empty list. This behavior is consistent with the
Python `range` function, but differs from the
tf.range
op, which returns
an error for these cases. Examples:
The input tensors `starts`, `limits`, and `deltas` may be scalars or vectors.
The vector inputs must all have the same size. Scalar inputs are broadcast
to match the size of the vector inputs.
Parameters
-
IEnumerable<int>
starts - Vector or scalar `Tensor`. Specifies the first entry for each range if `limits` is not `None`; otherwise, specifies the range limits, and the first entries default to `0`.
-
int
limits - Vector or scalar `Tensor`. Specifies the exclusive upper limits for each range.
-
ImplicitContainer<T>
deltas - Vector or scalar `Tensor`. Specifies the increment for each range. Defaults to `1`.
-
DType
dtype - The type of the elements of the resulting tensor. If not specified, then a value is chosen based on the other args.
-
string
name - A name for the operation.
-
ImplicitContainer<T>
row_splits_dtype - `dtype` for the returned `RaggedTensor`'s `row_splits`
tensor. One of
tf.int32
ortf.int64
.
Returns
-
RaggedTensor
- A `RaggedTensor` of type `dtype` with `ragged_rank=1`.
Show Example
ragged.range(starts, limits, deltas)[i] == tf.range(starts[i], limits[i], deltas[i])
RaggedTensor range(IEnumerable<int> starts, IGraphNodeBase limits, ImplicitContainer<T> deltas, DType dtype, string name, ImplicitContainer<T> row_splits_dtype)
Returns a `RaggedTensor` containing the specified sequences of numbers. Each row of the returned `RaggedTensor` contains a single sequence:
If `start[i] < limits[i] and deltas[i] > 0`, then `output[i]` will be an
empty list. Similarly, if `start[i] > limits[i] and deltas[i] < 0`, then
`output[i]` will be an empty list. This behavior is consistent with the
Python `range` function, but differs from the
tf.range
op, which returns
an error for these cases. Examples:
The input tensors `starts`, `limits`, and `deltas` may be scalars or vectors.
The vector inputs must all have the same size. Scalar inputs are broadcast
to match the size of the vector inputs.
Parameters
-
IEnumerable<int>
starts - Vector or scalar `Tensor`. Specifies the first entry for each range if `limits` is not `None`; otherwise, specifies the range limits, and the first entries default to `0`.
-
IGraphNodeBase
limits - Vector or scalar `Tensor`. Specifies the exclusive upper limits for each range.
-
ImplicitContainer<T>
deltas - Vector or scalar `Tensor`. Specifies the increment for each range. Defaults to `1`.
-
DType
dtype - The type of the elements of the resulting tensor. If not specified, then a value is chosen based on the other args.
-
string
name - A name for the operation.
-
ImplicitContainer<T>
row_splits_dtype - `dtype` for the returned `RaggedTensor`'s `row_splits`
tensor. One of
tf.int32
ortf.int64
.
Returns
-
RaggedTensor
- A `RaggedTensor` of type `dtype` with `ragged_rank=1`.
Show Example
ragged.range(starts, limits, deltas)[i] == tf.range(starts[i], limits[i], deltas[i])
RaggedTensor range(ValueTuple<IEnumerable<object>, object> starts, IEnumerable<int> limits, ImplicitContainer<T> deltas, DType dtype, string name, ImplicitContainer<T> row_splits_dtype)
Returns a `RaggedTensor` containing the specified sequences of numbers. Each row of the returned `RaggedTensor` contains a single sequence:
If `start[i] < limits[i] and deltas[i] > 0`, then `output[i]` will be an
empty list. Similarly, if `start[i] > limits[i] and deltas[i] < 0`, then
`output[i]` will be an empty list. This behavior is consistent with the
Python `range` function, but differs from the
tf.range
op, which returns
an error for these cases. Examples:
The input tensors `starts`, `limits`, and `deltas` may be scalars or vectors.
The vector inputs must all have the same size. Scalar inputs are broadcast
to match the size of the vector inputs.
Parameters
-
ValueTuple<IEnumerable<object>, object>
starts - Vector or scalar `Tensor`. Specifies the first entry for each range if `limits` is not `None`; otherwise, specifies the range limits, and the first entries default to `0`.
-
IEnumerable<int>
limits - Vector or scalar `Tensor`. Specifies the exclusive upper limits for each range.
-
ImplicitContainer<T>
deltas - Vector or scalar `Tensor`. Specifies the increment for each range. Defaults to `1`.
-
DType
dtype - The type of the elements of the resulting tensor. If not specified, then a value is chosen based on the other args.
-
string
name - A name for the operation.
-
ImplicitContainer<T>
row_splits_dtype - `dtype` for the returned `RaggedTensor`'s `row_splits`
tensor. One of
tf.int32
ortf.int64
.
Returns
-
RaggedTensor
- A `RaggedTensor` of type `dtype` with `ragged_rank=1`.
Show Example
ragged.range(starts, limits, deltas)[i] == tf.range(starts[i], limits[i], deltas[i])
RaggedTensor range(int starts, int limits, ImplicitContainer<T> deltas, DType dtype, string name, ImplicitContainer<T> row_splits_dtype)
Returns a `RaggedTensor` containing the specified sequences of numbers. Each row of the returned `RaggedTensor` contains a single sequence:
If `start[i] < limits[i] and deltas[i] > 0`, then `output[i]` will be an
empty list. Similarly, if `start[i] > limits[i] and deltas[i] < 0`, then
`output[i]` will be an empty list. This behavior is consistent with the
Python `range` function, but differs from the
tf.range
op, which returns
an error for these cases. Examples:
The input tensors `starts`, `limits`, and `deltas` may be scalars or vectors.
The vector inputs must all have the same size. Scalar inputs are broadcast
to match the size of the vector inputs.
Parameters
-
int
starts - Vector or scalar `Tensor`. Specifies the first entry for each range if `limits` is not `None`; otherwise, specifies the range limits, and the first entries default to `0`.
-
int
limits - Vector or scalar `Tensor`. Specifies the exclusive upper limits for each range.
-
ImplicitContainer<T>
deltas - Vector or scalar `Tensor`. Specifies the increment for each range. Defaults to `1`.
-
DType
dtype - The type of the elements of the resulting tensor. If not specified, then a value is chosen based on the other args.
-
string
name - A name for the operation.
-
ImplicitContainer<T>
row_splits_dtype - `dtype` for the returned `RaggedTensor`'s `row_splits`
tensor. One of
tf.int32
ortf.int64
.
Returns
-
RaggedTensor
- A `RaggedTensor` of type `dtype` with `ragged_rank=1`.
Show Example
ragged.range(starts, limits, deltas)[i] == tf.range(starts[i], limits[i], deltas[i])
RaggedTensor range(int starts, ValueTuple<IEnumerable<object>, object> limits, ImplicitContainer<T> deltas, DType dtype, string name, ImplicitContainer<T> row_splits_dtype)
Returns a `RaggedTensor` containing the specified sequences of numbers. Each row of the returned `RaggedTensor` contains a single sequence:
If `start[i] < limits[i] and deltas[i] > 0`, then `output[i]` will be an
empty list. Similarly, if `start[i] > limits[i] and deltas[i] < 0`, then
`output[i]` will be an empty list. This behavior is consistent with the
Python `range` function, but differs from the
tf.range
op, which returns
an error for these cases. Examples:
The input tensors `starts`, `limits`, and `deltas` may be scalars or vectors.
The vector inputs must all have the same size. Scalar inputs are broadcast
to match the size of the vector inputs.
Parameters
-
int
starts - Vector or scalar `Tensor`. Specifies the first entry for each range if `limits` is not `None`; otherwise, specifies the range limits, and the first entries default to `0`.
-
ValueTuple<IEnumerable<object>, object>
limits - Vector or scalar `Tensor`. Specifies the exclusive upper limits for each range.
-
ImplicitContainer<T>
deltas - Vector or scalar `Tensor`. Specifies the increment for each range. Defaults to `1`.
-
DType
dtype - The type of the elements of the resulting tensor. If not specified, then a value is chosen based on the other args.
-
string
name - A name for the operation.
-
ImplicitContainer<T>
row_splits_dtype - `dtype` for the returned `RaggedTensor`'s `row_splits`
tensor. One of
tf.int32
ortf.int64
.
Returns
-
RaggedTensor
- A `RaggedTensor` of type `dtype` with `ragged_rank=1`.
Show Example
ragged.range(starts, limits, deltas)[i] == tf.range(starts[i], limits[i], deltas[i])
RaggedTensor range(ValueTuple<IEnumerable<object>, object> starts, int limits, ImplicitContainer<T> deltas, DType dtype, string name, ImplicitContainer<T> row_splits_dtype)
Returns a `RaggedTensor` containing the specified sequences of numbers. Each row of the returned `RaggedTensor` contains a single sequence:
If `start[i] < limits[i] and deltas[i] > 0`, then `output[i]` will be an
empty list. Similarly, if `start[i] > limits[i] and deltas[i] < 0`, then
`output[i]` will be an empty list. This behavior is consistent with the
Python `range` function, but differs from the
tf.range
op, which returns
an error for these cases. Examples:
The input tensors `starts`, `limits`, and `deltas` may be scalars or vectors.
The vector inputs must all have the same size. Scalar inputs are broadcast
to match the size of the vector inputs.
Parameters
-
ValueTuple<IEnumerable<object>, object>
starts - Vector or scalar `Tensor`. Specifies the first entry for each range if `limits` is not `None`; otherwise, specifies the range limits, and the first entries default to `0`.
-
int
limits - Vector or scalar `Tensor`. Specifies the exclusive upper limits for each range.
-
ImplicitContainer<T>
deltas - Vector or scalar `Tensor`. Specifies the increment for each range. Defaults to `1`.
-
DType
dtype - The type of the elements of the resulting tensor. If not specified, then a value is chosen based on the other args.
-
string
name - A name for the operation.
-
ImplicitContainer<T>
row_splits_dtype - `dtype` for the returned `RaggedTensor`'s `row_splits`
tensor. One of
tf.int32
ortf.int64
.
Returns
-
RaggedTensor
- A `RaggedTensor` of type `dtype` with `ragged_rank=1`.
Show Example
ragged.range(starts, limits, deltas)[i] == tf.range(starts[i], limits[i], deltas[i])
RaggedTensor range(IGraphNodeBase starts, IGraphNodeBase limits, ImplicitContainer<T> deltas, DType dtype, string name, ImplicitContainer<T> row_splits_dtype)
Returns a `RaggedTensor` containing the specified sequences of numbers. Each row of the returned `RaggedTensor` contains a single sequence:
If `start[i] < limits[i] and deltas[i] > 0`, then `output[i]` will be an
empty list. Similarly, if `start[i] > limits[i] and deltas[i] < 0`, then
`output[i]` will be an empty list. This behavior is consistent with the
Python `range` function, but differs from the
tf.range
op, which returns
an error for these cases. Examples:
The input tensors `starts`, `limits`, and `deltas` may be scalars or vectors.
The vector inputs must all have the same size. Scalar inputs are broadcast
to match the size of the vector inputs.
Parameters
-
IGraphNodeBase
starts - Vector or scalar `Tensor`. Specifies the first entry for each range if `limits` is not `None`; otherwise, specifies the range limits, and the first entries default to `0`.
-
IGraphNodeBase
limits - Vector or scalar `Tensor`. Specifies the exclusive upper limits for each range.
-
ImplicitContainer<T>
deltas - Vector or scalar `Tensor`. Specifies the increment for each range. Defaults to `1`.
-
DType
dtype - The type of the elements of the resulting tensor. If not specified, then a value is chosen based on the other args.
-
string
name - A name for the operation.
-
ImplicitContainer<T>
row_splits_dtype - `dtype` for the returned `RaggedTensor`'s `row_splits`
tensor. One of
tf.int32
ortf.int64
.
Returns
-
RaggedTensor
- A `RaggedTensor` of type `dtype` with `ragged_rank=1`.
Show Example
ragged.range(starts, limits, deltas)[i] == tf.range(starts[i], limits[i], deltas[i])
RaggedTensor range(ValueTuple<IEnumerable<object>, object> starts, IGraphNodeBase limits, ImplicitContainer<T> deltas, DType dtype, string name, ImplicitContainer<T> row_splits_dtype)
Returns a `RaggedTensor` containing the specified sequences of numbers. Each row of the returned `RaggedTensor` contains a single sequence:
If `start[i] < limits[i] and deltas[i] > 0`, then `output[i]` will be an
empty list. Similarly, if `start[i] > limits[i] and deltas[i] < 0`, then
`output[i]` will be an empty list. This behavior is consistent with the
Python `range` function, but differs from the
tf.range
op, which returns
an error for these cases. Examples:
The input tensors `starts`, `limits`, and `deltas` may be scalars or vectors.
The vector inputs must all have the same size. Scalar inputs are broadcast
to match the size of the vector inputs.
Parameters
-
ValueTuple<IEnumerable<object>, object>
starts - Vector or scalar `Tensor`. Specifies the first entry for each range if `limits` is not `None`; otherwise, specifies the range limits, and the first entries default to `0`.
-
IGraphNodeBase
limits - Vector or scalar `Tensor`. Specifies the exclusive upper limits for each range.
-
ImplicitContainer<T>
deltas - Vector or scalar `Tensor`. Specifies the increment for each range. Defaults to `1`.
-
DType
dtype - The type of the elements of the resulting tensor. If not specified, then a value is chosen based on the other args.
-
string
name - A name for the operation.
-
ImplicitContainer<T>
row_splits_dtype - `dtype` for the returned `RaggedTensor`'s `row_splits`
tensor. One of
tf.int32
ortf.int64
.
Returns
-
RaggedTensor
- A `RaggedTensor` of type `dtype` with `ragged_rank=1`.
Show Example
ragged.range(starts, limits, deltas)[i] == tf.range(starts[i], limits[i], deltas[i])
RaggedTensor range(int starts, IEnumerable<int> limits, ImplicitContainer<T> deltas, DType dtype, string name, ImplicitContainer<T> row_splits_dtype)
Returns a `RaggedTensor` containing the specified sequences of numbers. Each row of the returned `RaggedTensor` contains a single sequence:
If `start[i] < limits[i] and deltas[i] > 0`, then `output[i]` will be an
empty list. Similarly, if `start[i] > limits[i] and deltas[i] < 0`, then
`output[i]` will be an empty list. This behavior is consistent with the
Python `range` function, but differs from the
tf.range
op, which returns
an error for these cases. Examples:
The input tensors `starts`, `limits`, and `deltas` may be scalars or vectors.
The vector inputs must all have the same size. Scalar inputs are broadcast
to match the size of the vector inputs.
Parameters
-
int
starts - Vector or scalar `Tensor`. Specifies the first entry for each range if `limits` is not `None`; otherwise, specifies the range limits, and the first entries default to `0`.
-
IEnumerable<int>
limits - Vector or scalar `Tensor`. Specifies the exclusive upper limits for each range.
-
ImplicitContainer<T>
deltas - Vector or scalar `Tensor`. Specifies the increment for each range. Defaults to `1`.
-
DType
dtype - The type of the elements of the resulting tensor. If not specified, then a value is chosen based on the other args.
-
string
name - A name for the operation.
-
ImplicitContainer<T>
row_splits_dtype - `dtype` for the returned `RaggedTensor`'s `row_splits`
tensor. One of
tf.int32
ortf.int64
.
Returns
-
RaggedTensor
- A `RaggedTensor` of type `dtype` with `ragged_rank=1`.
Show Example
ragged.range(starts, limits, deltas)[i] == tf.range(starts[i], limits[i], deltas[i])
RaggedTensor range(IEnumerable<int> starts, IEnumerable<int> limits, ImplicitContainer<T> deltas, DType dtype, string name, ImplicitContainer<T> row_splits_dtype)
Returns a `RaggedTensor` containing the specified sequences of numbers. Each row of the returned `RaggedTensor` contains a single sequence:
If `start[i] < limits[i] and deltas[i] > 0`, then `output[i]` will be an
empty list. Similarly, if `start[i] > limits[i] and deltas[i] < 0`, then
`output[i]` will be an empty list. This behavior is consistent with the
Python `range` function, but differs from the
tf.range
op, which returns
an error for these cases. Examples:
The input tensors `starts`, `limits`, and `deltas` may be scalars or vectors.
The vector inputs must all have the same size. Scalar inputs are broadcast
to match the size of the vector inputs.
Parameters
-
IEnumerable<int>
starts - Vector or scalar `Tensor`. Specifies the first entry for each range if `limits` is not `None`; otherwise, specifies the range limits, and the first entries default to `0`.
-
IEnumerable<int>
limits - Vector or scalar `Tensor`. Specifies the exclusive upper limits for each range.
-
ImplicitContainer<T>
deltas - Vector or scalar `Tensor`. Specifies the increment for each range. Defaults to `1`.
-
DType
dtype - The type of the elements of the resulting tensor. If not specified, then a value is chosen based on the other args.
-
string
name - A name for the operation.
-
ImplicitContainer<T>
row_splits_dtype - `dtype` for the returned `RaggedTensor`'s `row_splits`
tensor. One of
tf.int32
ortf.int64
.
Returns
-
RaggedTensor
- A `RaggedTensor` of type `dtype` with `ragged_rank=1`.
Show Example
ragged.range(starts, limits, deltas)[i] == tf.range(starts[i], limits[i], deltas[i])
RaggedTensor range(IGraphNodeBase starts, ValueTuple<IEnumerable<object>, object> limits, ImplicitContainer<T> deltas, DType dtype, string name, ImplicitContainer<T> row_splits_dtype)
Returns a `RaggedTensor` containing the specified sequences of numbers. Each row of the returned `RaggedTensor` contains a single sequence:
If `start[i] < limits[i] and deltas[i] > 0`, then `output[i]` will be an
empty list. Similarly, if `start[i] > limits[i] and deltas[i] < 0`, then
`output[i]` will be an empty list. This behavior is consistent with the
Python `range` function, but differs from the
tf.range
op, which returns
an error for these cases. Examples:
The input tensors `starts`, `limits`, and `deltas` may be scalars or vectors.
The vector inputs must all have the same size. Scalar inputs are broadcast
to match the size of the vector inputs.
Parameters
-
IGraphNodeBase
starts - Vector or scalar `Tensor`. Specifies the first entry for each range if `limits` is not `None`; otherwise, specifies the range limits, and the first entries default to `0`.
-
ValueTuple<IEnumerable<object>, object>
limits - Vector or scalar `Tensor`. Specifies the exclusive upper limits for each range.
-
ImplicitContainer<T>
deltas - Vector or scalar `Tensor`. Specifies the increment for each range. Defaults to `1`.
-
DType
dtype - The type of the elements of the resulting tensor. If not specified, then a value is chosen based on the other args.
-
string
name - A name for the operation.
-
ImplicitContainer<T>
row_splits_dtype - `dtype` for the returned `RaggedTensor`'s `row_splits`
tensor. One of
tf.int32
ortf.int64
.
Returns
-
RaggedTensor
- A `RaggedTensor` of type `dtype` with `ragged_rank=1`.
Show Example
ragged.range(starts, limits, deltas)[i] == tf.range(starts[i], limits[i], deltas[i])
RaggedTensor range(IGraphNodeBase starts, IEnumerable<int> limits, ImplicitContainer<T> deltas, DType dtype, string name, ImplicitContainer<T> row_splits_dtype)
Returns a `RaggedTensor` containing the specified sequences of numbers. Each row of the returned `RaggedTensor` contains a single sequence:
If `start[i] < limits[i] and deltas[i] > 0`, then `output[i]` will be an
empty list. Similarly, if `start[i] > limits[i] and deltas[i] < 0`, then
`output[i]` will be an empty list. This behavior is consistent with the
Python `range` function, but differs from the
tf.range
op, which returns
an error for these cases. Examples:
The input tensors `starts`, `limits`, and `deltas` may be scalars or vectors.
The vector inputs must all have the same size. Scalar inputs are broadcast
to match the size of the vector inputs.
Parameters
-
IGraphNodeBase
starts - Vector or scalar `Tensor`. Specifies the first entry for each range if `limits` is not `None`; otherwise, specifies the range limits, and the first entries default to `0`.
-
IEnumerable<int>
limits - Vector or scalar `Tensor`. Specifies the exclusive upper limits for each range.
-
ImplicitContainer<T>
deltas - Vector or scalar `Tensor`. Specifies the increment for each range. Defaults to `1`.
-
DType
dtype - The type of the elements of the resulting tensor. If not specified, then a value is chosen based on the other args.
-
string
name - A name for the operation.
-
ImplicitContainer<T>
row_splits_dtype - `dtype` for the returned `RaggedTensor`'s `row_splits`
tensor. One of
tf.int32
ortf.int64
.
Returns
-
RaggedTensor
- A `RaggedTensor` of type `dtype` with `ragged_rank=1`.
Show Example
ragged.range(starts, limits, deltas)[i] == tf.range(starts[i], limits[i], deltas[i])
RaggedTensor range(int starts, IGraphNodeBase limits, ImplicitContainer<T> deltas, DType dtype, string name, ImplicitContainer<T> row_splits_dtype)
Returns a `RaggedTensor` containing the specified sequences of numbers. Each row of the returned `RaggedTensor` contains a single sequence:
If `start[i] < limits[i] and deltas[i] > 0`, then `output[i]` will be an
empty list. Similarly, if `start[i] > limits[i] and deltas[i] < 0`, then
`output[i]` will be an empty list. This behavior is consistent with the
Python `range` function, but differs from the
tf.range
op, which returns
an error for these cases. Examples:
The input tensors `starts`, `limits`, and `deltas` may be scalars or vectors.
The vector inputs must all have the same size. Scalar inputs are broadcast
to match the size of the vector inputs.
Parameters
-
int
starts - Vector or scalar `Tensor`. Specifies the first entry for each range if `limits` is not `None`; otherwise, specifies the range limits, and the first entries default to `0`.
-
IGraphNodeBase
limits - Vector or scalar `Tensor`. Specifies the exclusive upper limits for each range.
-
ImplicitContainer<T>
deltas - Vector or scalar `Tensor`. Specifies the increment for each range. Defaults to `1`.
-
DType
dtype - The type of the elements of the resulting tensor. If not specified, then a value is chosen based on the other args.
-
string
name - A name for the operation.
-
ImplicitContainer<T>
row_splits_dtype - `dtype` for the returned `RaggedTensor`'s `row_splits`
tensor. One of
tf.int32
ortf.int64
.
Returns
-
RaggedTensor
- A `RaggedTensor` of type `dtype` with `ragged_rank=1`.
Show Example
ragged.range(starts, limits, deltas)[i] == tf.range(starts[i], limits[i], deltas[i])
RaggedTensor range(ValueTuple<IEnumerable<object>, object> starts, ValueTuple<IEnumerable<object>, object> limits, ImplicitContainer<T> deltas, DType dtype, string name, ImplicitContainer<T> row_splits_dtype)
Returns a `RaggedTensor` containing the specified sequences of numbers. Each row of the returned `RaggedTensor` contains a single sequence:
If `start[i] < limits[i] and deltas[i] > 0`, then `output[i]` will be an
empty list. Similarly, if `start[i] > limits[i] and deltas[i] < 0`, then
`output[i]` will be an empty list. This behavior is consistent with the
Python `range` function, but differs from the
tf.range
op, which returns
an error for these cases. Examples:
The input tensors `starts`, `limits`, and `deltas` may be scalars or vectors.
The vector inputs must all have the same size. Scalar inputs are broadcast
to match the size of the vector inputs.
Parameters
-
ValueTuple<IEnumerable<object>, object>
starts - Vector or scalar `Tensor`. Specifies the first entry for each range if `limits` is not `None`; otherwise, specifies the range limits, and the first entries default to `0`.
-
ValueTuple<IEnumerable<object>, object>
limits - Vector or scalar `Tensor`. Specifies the exclusive upper limits for each range.
-
ImplicitContainer<T>
deltas - Vector or scalar `Tensor`. Specifies the increment for each range. Defaults to `1`.
-
DType
dtype - The type of the elements of the resulting tensor. If not specified, then a value is chosen based on the other args.
-
string
name - A name for the operation.
-
ImplicitContainer<T>
row_splits_dtype - `dtype` for the returned `RaggedTensor`'s `row_splits`
tensor. One of
tf.int32
ortf.int64
.
Returns
-
RaggedTensor
- A `RaggedTensor` of type `dtype` with `ragged_rank=1`.
Show Example
ragged.range(starts, limits, deltas)[i] == tf.range(starts[i], limits[i], deltas[i])
RaggedTensor range(IGraphNodeBase starts, int limits, ImplicitContainer<T> deltas, DType dtype, string name, ImplicitContainer<T> row_splits_dtype)
Returns a `RaggedTensor` containing the specified sequences of numbers. Each row of the returned `RaggedTensor` contains a single sequence:
If `start[i] < limits[i] and deltas[i] > 0`, then `output[i]` will be an
empty list. Similarly, if `start[i] > limits[i] and deltas[i] < 0`, then
`output[i]` will be an empty list. This behavior is consistent with the
Python `range` function, but differs from the
tf.range
op, which returns
an error for these cases. Examples:
The input tensors `starts`, `limits`, and `deltas` may be scalars or vectors.
The vector inputs must all have the same size. Scalar inputs are broadcast
to match the size of the vector inputs.
Parameters
-
IGraphNodeBase
starts - Vector or scalar `Tensor`. Specifies the first entry for each range if `limits` is not `None`; otherwise, specifies the range limits, and the first entries default to `0`.
-
int
limits - Vector or scalar `Tensor`. Specifies the exclusive upper limits for each range.
-
ImplicitContainer<T>
deltas - Vector or scalar `Tensor`. Specifies the increment for each range. Defaults to `1`.
-
DType
dtype - The type of the elements of the resulting tensor. If not specified, then a value is chosen based on the other args.
-
string
name - A name for the operation.
-
ImplicitContainer<T>
row_splits_dtype - `dtype` for the returned `RaggedTensor`'s `row_splits`
tensor. One of
tf.int32
ortf.int64
.
Returns
-
RaggedTensor
- A `RaggedTensor` of type `dtype` with `ragged_rank=1`.
Show Example
ragged.range(starts, limits, deltas)[i] == tf.range(starts[i], limits[i], deltas[i])
object range_dyn(object starts, object limits, ImplicitContainer<T> deltas, object dtype, object name, ImplicitContainer<T> row_splits_dtype)
Returns a `RaggedTensor` containing the specified sequences of numbers. Each row of the returned `RaggedTensor` contains a single sequence:
If `start[i] < limits[i] and deltas[i] > 0`, then `output[i]` will be an
empty list. Similarly, if `start[i] > limits[i] and deltas[i] < 0`, then
`output[i]` will be an empty list. This behavior is consistent with the
Python `range` function, but differs from the
tf.range
op, which returns
an error for these cases. Examples:
The input tensors `starts`, `limits`, and `deltas` may be scalars or vectors.
The vector inputs must all have the same size. Scalar inputs are broadcast
to match the size of the vector inputs.
Parameters
-
object
starts - Vector or scalar `Tensor`. Specifies the first entry for each range if `limits` is not `None`; otherwise, specifies the range limits, and the first entries default to `0`.
-
object
limits - Vector or scalar `Tensor`. Specifies the exclusive upper limits for each range.
-
ImplicitContainer<T>
deltas - Vector or scalar `Tensor`. Specifies the increment for each range. Defaults to `1`.
-
object
dtype - The type of the elements of the resulting tensor. If not specified, then a value is chosen based on the other args.
-
object
name - A name for the operation.
-
ImplicitContainer<T>
row_splits_dtype - `dtype` for the returned `RaggedTensor`'s `row_splits`
tensor. One of
tf.int32
ortf.int64
.
Returns
-
object
- A `RaggedTensor` of type `dtype` with `ragged_rank=1`.
Show Example
ragged.range(starts, limits, deltas)[i] == tf.range(starts[i], limits[i], deltas[i])
Tensor row_splits_to_segment_ids(IGraphNodeBase splits, string name, object out_type)
Generates the segmentation corresponding to a RaggedTensor `row_splits`. Returns an integer vector `segment_ids`, where `segment_ids[i] == j` if
`splits[j] <= i < splits[j+1]`. Example:
Parameters
-
IGraphNodeBase
splits - A sorted 1-D integer Tensor. `splits[0]` must be zero.
-
string
name - A name prefix for the returned tensor (optional).
-
object
out_type - The dtype for the return value. Defaults to `splits.dtype`,
or
tf.int64
if `splits` does not have a dtype.
Returns
-
Tensor
- A sorted 1-D integer Tensor, with `shape=[splits[-1]]`
Show Example
>>> ragged.row_splits_to_segment_ids([0, 3, 3, 5, 6, 9]).eval() [ 0 0 0 2 2 3 4 4 4 ]
Tensor row_splits_to_segment_ids(IEnumerable<int> splits, string name, object out_type)
Generates the segmentation corresponding to a RaggedTensor `row_splits`. Returns an integer vector `segment_ids`, where `segment_ids[i] == j` if
`splits[j] <= i < splits[j+1]`. Example:
Parameters
-
IEnumerable<int>
splits - A sorted 1-D integer Tensor. `splits[0]` must be zero.
-
string
name - A name prefix for the returned tensor (optional).
-
object
out_type - The dtype for the return value. Defaults to `splits.dtype`,
or
tf.int64
if `splits` does not have a dtype.
Returns
-
Tensor
- A sorted 1-D integer Tensor, with `shape=[splits[-1]]`
Show Example
>>> ragged.row_splits_to_segment_ids([0, 3, 3, 5, 6, 9]).eval() [ 0 0 0 2 2 3 4 4 4 ]
Tensor row_splits_to_segment_ids(ValueTuple<IEnumerable<object>, object> splits, string name, object out_type)
Generates the segmentation corresponding to a RaggedTensor `row_splits`. Returns an integer vector `segment_ids`, where `segment_ids[i] == j` if
`splits[j] <= i < splits[j+1]`. Example:
Parameters
-
ValueTuple<IEnumerable<object>, object>
splits - A sorted 1-D integer Tensor. `splits[0]` must be zero.
-
string
name - A name prefix for the returned tensor (optional).
-
object
out_type - The dtype for the return value. Defaults to `splits.dtype`,
or
tf.int64
if `splits` does not have a dtype.
Returns
-
Tensor
- A sorted 1-D integer Tensor, with `shape=[splits[-1]]`
Show Example
>>> ragged.row_splits_to_segment_ids([0, 3, 3, 5, 6, 9]).eval() [ 0 0 0 2 2 3 4 4 4 ]
object row_splits_to_segment_ids_dyn(object splits, object name, object out_type)
Generates the segmentation corresponding to a RaggedTensor `row_splits`. Returns an integer vector `segment_ids`, where `segment_ids[i] == j` if
`splits[j] <= i < splits[j+1]`. Example:
Parameters
-
object
splits - A sorted 1-D integer Tensor. `splits[0]` must be zero.
-
object
name - A name prefix for the returned tensor (optional).
-
object
out_type - The dtype for the return value. Defaults to `splits.dtype`,
or
tf.int64
if `splits` does not have a dtype.
Returns
-
object
- A sorted 1-D integer Tensor, with `shape=[splits[-1]]`
Show Example
>>> ragged.row_splits_to_segment_ids([0, 3, 3, 5, 6, 9]).eval() [ 0 0 0 2 2 3 4 4 4 ]
Tensor segment_ids_to_row_splits(IGraphNodeBase segment_ids, IGraphNodeBase num_segments, object out_type, string name)
Generates the RaggedTensor `row_splits` corresponding to a segmentation. Returns an integer vector `splits`, where `splits[0] = 0` and
`splits[i] = splits[i-1] + count(segment_ids==i)`. Example:
Parameters
-
IGraphNodeBase
segment_ids - A 1-D integer Tensor.
-
IGraphNodeBase
num_segments - A scalar integer indicating the number of segments. Defaults to `max(segment_ids) + 1` (or zero if `segment_ids` is empty).
-
object
out_type - The dtype for the return value. Defaults to `segment_ids.dtype`,
or
tf.int64
if `segment_ids` does not have a dtype. -
string
name - A name prefix for the returned tensor (optional).
Returns
-
Tensor
- A sorted 1-D integer Tensor, with `shape=[num_segments + 1]`.
Show Example
>>> ragged.segment_ids_to_row_splits([0, 0, 0, 2, 2, 3, 4, 4, 4]).eval() [ 0 3 3 5 6 9 ]
Tensor segment_ids_to_row_splits(IEnumerable<int> segment_ids, int num_segments, object out_type, string name)
Generates the RaggedTensor `row_splits` corresponding to a segmentation. Returns an integer vector `splits`, where `splits[0] = 0` and
`splits[i] = splits[i-1] + count(segment_ids==i)`. Example:
Parameters
-
IEnumerable<int>
segment_ids - A 1-D integer Tensor.
-
int
num_segments - A scalar integer indicating the number of segments. Defaults to `max(segment_ids) + 1` (or zero if `segment_ids` is empty).
-
object
out_type - The dtype for the return value. Defaults to `segment_ids.dtype`,
or
tf.int64
if `segment_ids` does not have a dtype. -
string
name - A name prefix for the returned tensor (optional).
Returns
-
Tensor
- A sorted 1-D integer Tensor, with `shape=[num_segments + 1]`.
Show Example
>>> ragged.segment_ids_to_row_splits([0, 0, 0, 2, 2, 3, 4, 4, 4]).eval() [ 0 3 3 5 6 9 ]
Tensor segment_ids_to_row_splits(IEnumerable<int> segment_ids, IGraphNodeBase num_segments, object out_type, string name)
Generates the RaggedTensor `row_splits` corresponding to a segmentation. Returns an integer vector `splits`, where `splits[0] = 0` and
`splits[i] = splits[i-1] + count(segment_ids==i)`. Example:
Parameters
-
IEnumerable<int>
segment_ids - A 1-D integer Tensor.
-
IGraphNodeBase
num_segments - A scalar integer indicating the number of segments. Defaults to `max(segment_ids) + 1` (or zero if `segment_ids` is empty).
-
object
out_type - The dtype for the return value. Defaults to `segment_ids.dtype`,
or
tf.int64
if `segment_ids` does not have a dtype. -
string
name - A name prefix for the returned tensor (optional).
Returns
-
Tensor
- A sorted 1-D integer Tensor, with `shape=[num_segments + 1]`.
Show Example
>>> ragged.segment_ids_to_row_splits([0, 0, 0, 2, 2, 3, 4, 4, 4]).eval() [ 0 3 3 5 6 9 ]
Tensor segment_ids_to_row_splits(IGraphNodeBase segment_ids, int num_segments, object out_type, string name)
Generates the RaggedTensor `row_splits` corresponding to a segmentation. Returns an integer vector `splits`, where `splits[0] = 0` and
`splits[i] = splits[i-1] + count(segment_ids==i)`. Example:
Parameters
-
IGraphNodeBase
segment_ids - A 1-D integer Tensor.
-
int
num_segments - A scalar integer indicating the number of segments. Defaults to `max(segment_ids) + 1` (or zero if `segment_ids` is empty).
-
object
out_type - The dtype for the return value. Defaults to `segment_ids.dtype`,
or
tf.int64
if `segment_ids` does not have a dtype. -
string
name - A name prefix for the returned tensor (optional).
Returns
-
Tensor
- A sorted 1-D integer Tensor, with `shape=[num_segments + 1]`.
Show Example
>>> ragged.segment_ids_to_row_splits([0, 0, 0, 2, 2, 3, 4, 4, 4]).eval() [ 0 3 3 5 6 9 ]
object segment_ids_to_row_splits_dyn(object segment_ids, object num_segments, object out_type, object name)
Generates the RaggedTensor `row_splits` corresponding to a segmentation. Returns an integer vector `splits`, where `splits[0] = 0` and
`splits[i] = splits[i-1] + count(segment_ids==i)`. Example:
Parameters
-
object
segment_ids - A 1-D integer Tensor.
-
object
num_segments - A scalar integer indicating the number of segments. Defaults to `max(segment_ids) + 1` (or zero if `segment_ids` is empty).
-
object
out_type - The dtype for the return value. Defaults to `segment_ids.dtype`,
or
tf.int64
if `segment_ids` does not have a dtype. -
object
name - A name prefix for the returned tensor (optional).
Returns
-
object
- A sorted 1-D integer Tensor, with `shape=[num_segments + 1]`.
Show Example
>>> ragged.segment_ids_to_row_splits([0, 0, 0, 2, 2, 3, 4, 4, 4]).eval() [ 0 3 3 5 6 9 ]
object stack(IGraphNodeBase values, int axis, string name)
Stacks a list of rank-`R` tensors into one rank-`(R+1)` `RaggedTensor`. Given a list of tensors or ragged tensors with the same rank `R`
(`R >= axis`), returns a rank-`R+1` `RaggedTensor` `result` such that
`result[i0...iaxis]` is `[value[i0...iaxis] for value in values]`. #### Example:
Parameters
-
IGraphNodeBase
values - A list of
tf.Tensor
ortf.RaggedTensor
. May not be empty. All `values` must have the same rank and the same dtype; but unliketf.stack
, they can have arbitrary dimension sizes. -
int
axis - A python integer, indicating the dimension along which to stack.
(Note: Unlike
tf.stack
, the `axis` parameter must be statically known.) Negative values are supported only if the rank of at least one `values` value is statically known. -
string
name - A name prefix for the returned tensor (optional).
Returns
-
object
- A `RaggedTensor` with rank `R+1`. `result.ragged_rank=1+max(axis, max(rt.ragged_rank for rt in values]))`.
Show Example
>>> t1 = tf.ragged.constant([[1, 2], [3, 4, 5]]) >>> t2 = tf.ragged.constant([[6], [7, 8, 9]]) >>> tf.ragged.stack([t1, t2], axis=0) [[[1, 2], [3, 4, 5]], [[6], [7, 9, 0]]] >>> tf.ragged.stack([t1, t2], axis=1) [[[1, 2], [6]], [[3, 4, 5], [7, 8, 9]]]
object stack(int values, int axis, string name)
Stacks a list of rank-`R` tensors into one rank-`(R+1)` `RaggedTensor`. Given a list of tensors or ragged tensors with the same rank `R`
(`R >= axis`), returns a rank-`R+1` `RaggedTensor` `result` such that
`result[i0...iaxis]` is `[value[i0...iaxis] for value in values]`. #### Example:
Parameters
-
int
values - A list of
tf.Tensor
ortf.RaggedTensor
. May not be empty. All `values` must have the same rank and the same dtype; but unliketf.stack
, they can have arbitrary dimension sizes. -
int
axis - A python integer, indicating the dimension along which to stack.
(Note: Unlike
tf.stack
, the `axis` parameter must be statically known.) Negative values are supported only if the rank of at least one `values` value is statically known. -
string
name - A name prefix for the returned tensor (optional).
Returns
-
object
- A `RaggedTensor` with rank `R+1`. `result.ragged_rank=1+max(axis, max(rt.ragged_rank for rt in values]))`.
Show Example
>>> t1 = tf.ragged.constant([[1, 2], [3, 4, 5]]) >>> t2 = tf.ragged.constant([[6], [7, 8, 9]]) >>> tf.ragged.stack([t1, t2], axis=0) [[[1, 2], [3, 4, 5]], [[6], [7, 9, 0]]] >>> tf.ragged.stack([t1, t2], axis=1) [[[1, 2], [6]], [[3, 4, 5], [7, 8, 9]]]
object stack(RaggedTensor values, int axis, string name)
Stacks a list of rank-`R` tensors into one rank-`(R+1)` `RaggedTensor`. Given a list of tensors or ragged tensors with the same rank `R`
(`R >= axis`), returns a rank-`R+1` `RaggedTensor` `result` such that
`result[i0...iaxis]` is `[value[i0...iaxis] for value in values]`. #### Example:
Parameters
-
RaggedTensor
values - A list of
tf.Tensor
ortf.RaggedTensor
. May not be empty. All `values` must have the same rank and the same dtype; but unliketf.stack
, they can have arbitrary dimension sizes. -
int
axis - A python integer, indicating the dimension along which to stack.
(Note: Unlike
tf.stack
, the `axis` parameter must be statically known.) Negative values are supported only if the rank of at least one `values` value is statically known. -
string
name - A name prefix for the returned tensor (optional).
Returns
-
object
- A `RaggedTensor` with rank `R+1`. `result.ragged_rank=1+max(axis, max(rt.ragged_rank for rt in values]))`.
Show Example
>>> t1 = tf.ragged.constant([[1, 2], [3, 4, 5]]) >>> t2 = tf.ragged.constant([[6], [7, 8, 9]]) >>> tf.ragged.stack([t1, t2], axis=0) [[[1, 2], [3, 4, 5]], [[6], [7, 9, 0]]] >>> tf.ragged.stack([t1, t2], axis=1) [[[1, 2], [6]], [[3, 4, 5], [7, 8, 9]]]
object stack_dyn(object values, ImplicitContainer<T> axis, object name)
Stacks a list of rank-`R` tensors into one rank-`(R+1)` `RaggedTensor`. Given a list of tensors or ragged tensors with the same rank `R`
(`R >= axis`), returns a rank-`R+1` `RaggedTensor` `result` such that
`result[i0...iaxis]` is `[value[i0...iaxis] for value in values]`. #### Example:
Parameters
-
object
values - A list of
tf.Tensor
ortf.RaggedTensor
. May not be empty. All `values` must have the same rank and the same dtype; but unliketf.stack
, they can have arbitrary dimension sizes. -
ImplicitContainer<T>
axis - A python integer, indicating the dimension along which to stack.
(Note: Unlike
tf.stack
, the `axis` parameter must be statically known.) Negative values are supported only if the rank of at least one `values` value is statically known. -
object
name - A name prefix for the returned tensor (optional).
Returns
-
object
- A `RaggedTensor` with rank `R+1`. `result.ragged_rank=1+max(axis, max(rt.ragged_rank for rt in values]))`.
Show Example
>>> t1 = tf.ragged.constant([[1, 2], [3, 4, 5]]) >>> t2 = tf.ragged.constant([[6], [7, 8, 9]]) >>> tf.ragged.stack([t1, t2], axis=0) [[[1, 2], [3, 4, 5]], [[6], [7, 9, 0]]] >>> tf.ragged.stack([t1, t2], axis=1) [[[1, 2], [6]], [[3, 4, 5], [7, 8, 9]]]
RaggedTensor stack_dynamic_partitions(IGraphNodeBase data, IGraphNodeBase partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
IGraphNodeBase
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
IGraphNodeBase
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(IEnumerable<string> data, IEnumerable<object> partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
IEnumerable<string>
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
IEnumerable<object>
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(IEnumerable<string> data, RaggedTensor partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
IEnumerable<string>
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
RaggedTensor
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(IEnumerable<string> data, int partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
IEnumerable<string>
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
int
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(IEnumerable<string> data, IGraphNodeBase partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
IEnumerable<string>
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
IGraphNodeBase
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(IEnumerable<string> data, object partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
IEnumerable<string>
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
object
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(RaggedTensor data, IEnumerable<object> partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
RaggedTensor
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
IEnumerable<object>
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(RaggedTensor data, RaggedTensor partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
RaggedTensor
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
RaggedTensor
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(RaggedTensor data, int partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
RaggedTensor
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
int
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(object data, RaggedTensor partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
object
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
RaggedTensor
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(IGraphNodeBase data, RaggedTensor partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
IGraphNodeBase
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
RaggedTensor
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(IGraphNodeBase data, IEnumerable<object> partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
IGraphNodeBase
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
IEnumerable<object>
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(int data, object partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
int
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
object
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(IGraphNodeBase data, object partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
IGraphNodeBase
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
object
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(int data, IGraphNodeBase partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
int
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
IGraphNodeBase
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(object data, IEnumerable<object> partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
object
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
IEnumerable<object>
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(IGraphNodeBase data, int partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
IGraphNodeBase
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
int
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(RaggedTensor data, object partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
RaggedTensor
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
object
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(object data, IGraphNodeBase partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
object
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
IGraphNodeBase
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(object data, object partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
object
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
object
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(int data, int partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
int
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
int
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(int data, RaggedTensor partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
int
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
RaggedTensor
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(int data, IEnumerable<object> partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
int
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
IEnumerable<object>
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(RaggedTensor data, IGraphNodeBase partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
RaggedTensor
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
IGraphNodeBase
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
RaggedTensor stack_dynamic_partitions(object data, int partitions, object num_partitions, string name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
object
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
int
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
string
name - A name prefix for the returned tensor (optional).
Returns
-
RaggedTensor
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)
object stack_dynamic_partitions_dyn(object data, object partitions, object num_partitions, object name)
Stacks dynamic partitions of a Tensor or RaggedTensor. Returns a RaggedTensor `output` with `num_partitions` rows, where the row
`output[i]` is formed by stacking all slices `data[j1...jN]` such that
`partitions[j1...jN] = i`. Slices of `data` are stacked in row-major
order. If `num_partitions` is an `int` (not a `Tensor`), then this is equivalent to
`tf.ragged.stack(tf.dynamic_partition(data, partitions, num_partitions))`. ####Example:
Parameters
-
object
data - A `Tensor` or `RaggedTensor` containing the values to stack.
-
object
partitions - An `int32` or `int64` `Tensor` or `RaggedTensor` specifying the partition that each slice of `data` should be added to. `partitions.shape` must be a prefix of `data.shape`. Values must be greater than or equal to zero, and less than `num_partitions`. `partitions` is not required to be sorted.
-
object
num_partitions - An `int32` or `int64` scalar specifying the number of partitions to output. This determines the number of rows in `output`.
-
object
name - A name prefix for the returned tensor (optional).
Returns
-
object
- A `RaggedTensor` containing the stacked partitions. The returned tensor has the same dtype as `data`, and its shape is `[num_partitions, (D)] + data.shape[partitions.rank:]`, where `(D)` is a ragged dimension whose length is the number of data slices stacked for each `partition`.
Show Example
>>> data = ['a', 'b', 'c', 'd', 'e'] >>> partitions = [ 3, 0, 2, 2, 3] >>> num_partitions = 5 >>> tf.ragged.stack_dynamic_partitions(data, partitions, num_partitions)