tf.SparseTensorSpec
Stay organized with collections
Save and categorize content based on your preferences.
Type specification for a tf.SparseTensor
.
tf.SparseTensorSpec(
shape=None, dtype=tf.dtypes.float32
)
Args |
shape
|
The dense shape of the SparseTensor , or None to allow
any dense shape.
|
dtype
|
tf.DType of values in the SparseTensor .
|
Attributes |
dtype
|
The tf.dtypes.DType specified by this type for the SparseTensor.
|
shape
|
The tf.TensorShape specified by this type for the SparseTensor.
|
value_type
|
|
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.SparseTensorSpec\n\n\u003cbr /\u003e\n\n|-----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|\n| [TensorFlow 1 version](/versions/r1.15/api_docs/python/tf/SparseTensorSpec) | [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.0.0/tensorflow/python/framework/sparse_tensor.py#L261-L376) |\n\nType specification for a [`tf.SparseTensor`](../tf/sparse/SparseTensor).\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.SparseTensorSpec`](/api_docs/python/tf/SparseTensorSpec)\n\n\u003cbr /\u003e\n\n tf.SparseTensorSpec(\n shape=None, dtype=tf.dtypes.float32\n )\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------|----------------------------------------------------------------------------|\n| `shape` | The dense shape of the `SparseTensor`, or `None` to allow any dense shape. |\n| `dtype` | [`tf.DType`](../tf/dtypes/DType) of values in the `SparseTensor`. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ---------- ||\n|--------------|------------------------------------------------------------------------------------------|\n| `dtype` | The [`tf.dtypes.DType`](../tf/dtypes/DType) specified by this type for the SparseTensor. |\n| `shape` | The [`tf.TensorShape`](../tf/TensorShape) specified by this type for the SparseTensor. |\n| `value_type` | \u003cbr /\u003e \u003cbr /\u003e |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `from_value`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v2.0.0/tensorflow/python/framework/sparse_tensor.py#L366-L376) \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.0.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.0.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.0.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.0.0/tensorflow/python/framework/type_spec.py#L267-L268) \n\n __ne__(\n other\n )\n\nReturn self!=value."]]