tf.RaggedTensorSpec
Stay organized with collections
Save and categorize content based on your preferences.
Type specification for a tf.RaggedTensor
.
tf.RaggedTensorSpec(
shape=None, dtype=tf.dtypes.float32, ragged_rank=None,
row_splits_dtype=tf.dtypes.int64
)
Args |
shape
|
The shape of the RaggedTensor, or None to allow any shape. If
a shape is specified, then all ragged dimensions must have size None .
|
dtype
|
tf.DType of values in the RaggedTensor.
|
ragged_rank
|
Python integer, the ragged rank of the RaggedTensor
to be described. Defaults to shape.ndims - 1 .
|
row_splits_dtype
|
dtype for the RaggedTensor's row_splits tensor.
One of tf.int32 or tf.int64 .
|
Attributes |
value_type
|
The Python type for values that are compatible with this TypeSpec.
|
Methods
from_value
View source
@classmethod
from_value(
value
)
is_compatible_with
View source
is_compatible_with(
spec_or_value
)
Returns true if spec_or_value
is compatible with this TypeSpec.
most_specific_compatible_type
View source
most_specific_compatible_type(
other
)
Returns the most specific TypeSpec compatible with self
and other
.
Raises |
ValueError
|
If there is no TypeSpec that is compatible with both self
and other .
|
__eq__
View source
__eq__(
other
)
Return self==value.
__ne__
View source
__ne__(
other
)
Return self!=value.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.RaggedTensorSpec\n\n\u003cbr /\u003e\n\n|-----------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------|\n| [TensorFlow 1 version](/versions/r1.15/api_docs/python/tf/RaggedTensorSpec) | [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/ops/ragged/ragged_tensor.py#L2130-L2293) |\n\nType specification for a [`tf.RaggedTensor`](../tf/RaggedTensor).\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.RaggedTensorSpec`](/api_docs/python/tf/RaggedTensorSpec)\n\n\u003cbr /\u003e\n\n tf.RaggedTensorSpec(\n shape=None, dtype=tf.dtypes.float32, ragged_rank=None,\n row_splits_dtype=tf.dtypes.int64\n )\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------------------|-----------------------------------------------------------------------------------------------------------------------------------------|\n| `shape` | The shape of the RaggedTensor, or `None` to allow any shape. If a shape is specified, then all ragged dimensions must have size `None`. |\n| `dtype` | [`tf.DType`](../tf/dtypes/DType) of values in the RaggedTensor. |\n| `ragged_rank` | Python integer, the ragged rank of the RaggedTensor to be described. Defaults to `shape.ndims - 1`. |\n| `row_splits_dtype` | `dtype` for the RaggedTensor's `row_splits` tensor. One of [`tf.int32`](../tf#int32) or [`tf.int64`](../tf#int64). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ---------- ||\n|--------------|--------------------------------------------------------------------|\n| `value_type` | The Python type for values that are compatible with this TypeSpec. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `from_value`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/ops/ragged/ragged_tensor.py#L2288-L2293) \n\n @classmethod\n from_value(\n value\n )\n\n### `is_compatible_with`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/framework/type_spec.py#L87-L102) \n\n is_compatible_with(\n spec_or_value\n )\n\nReturns true if `spec_or_value` is compatible with this TypeSpec.\n\n### `most_specific_compatible_type`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/framework/type_spec.py#L104-L126) \n\n most_specific_compatible_type(\n other\n )\n\nReturns the most specific TypeSpec compatible with `self` and `other`.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|---------|---------------|\n| `other` | A `TypeSpec`. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ||\n|--------------|--------------------------------------------------------------------------|\n| `ValueError` | If there is no TypeSpec that is compatible with both `self` and `other`. |\n\n\u003cbr /\u003e\n\n### `__eq__`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/framework/type_spec.py#L262-L265) \n\n __eq__(\n other\n )\n\nReturn self==value.\n\n### `__ne__`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/framework/type_spec.py#L267-L268) \n\n __ne__(\n other\n )\n\nReturn self!=value."]]