# Module: tf_agents.specs.tensor_spec

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/specs/tensor_spec.py) |

Utilities related to TensorSpec class.

## Functions

[`add_outer_dim(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/specs/tensor_spec/add_outer_dim): Adds an outer dimension to the shape of input specs.

[`add_outer_dims_nest(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/specs/tensor_spec/add_outer_dims_nest): Adds outer dimensions to the shape of input specs.

[`from_packed_proto(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/specs/tensor_spec/from_packed_proto): Decodes a packed Any proto containing the structured value for the spec.

[`from_pbtxt_file(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/specs/tensor_spec/from_pbtxt_file): Loads a spec encoded as a struct_pb2.StructuredValue from a pbtxt file.

[`from_proto(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/specs/tensor_spec/from_proto): Decodes a struct_pb2.StructuredValue proto into a nested spec.

[`from_spec(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/specs/from_spec): Maps the given spec into corresponding TensorSpecs keeping bounds.

[`is_bounded(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/specs/is_bounded)

[`is_continuous(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/specs/is_continuous)

[`is_discrete(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/specs/is_discrete)

[`remove_outer_dims_nest(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/specs/tensor_spec/remove_outer_dims_nest): Removes the specified number of outer dimensions from the input spec nest.

[`sample_bounded_spec(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/specs/tensor_spec/sample_bounded_spec): Samples uniformily the given bounded spec.

[`sample_spec_nest(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/specs/sample_spec_nest): Samples the given nest of specs.

[`to_array_spec(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/specs/tensor_spec/to_array_spec): Converts TensorSpec into ArraySpec.

[`to_nest_array_spec(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/specs/tensor_spec/to_nest_array_spec): (Deprecated) Alias for `to_array_spec`.

[`to_nest_placeholder(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/specs/tensor_spec/to_nest_placeholder): Converts a nest of TensorSpecs to a nest of matching placeholders.

[`to_pbtxt_file(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/specs/tensor_spec/to_pbtxt_file): Saves a spec encoded as a struct_pb2.StructuredValue in a pbtxt file.

[`to_placeholder(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/specs/tensor_spec/to_placeholder): Creates a placeholder from TensorSpec.

[`to_placeholder_with_default(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/specs/tensor_spec/to_placeholder_with_default): Creates a placeholder from TensorSpec.

[`to_proto(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/specs/tensor_spec/to_proto): Encodes a nested spec into a struct_pb2.StructuredValue proto.

[`with_dtype(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/specs/tensor_spec/with_dtype): Updates dtypes of all specs in the input spec.

[`zero_spec_nest(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/specs/zero_spec_nest): Create zero tensors for a given spec.

<br />

<br />

<br />

| ## Other Members ||
|---|---|
| absolute_import | Instance of `__future__._Feature` |
| division | Instance of `__future__._Feature` |
| print_function | Instance of `__future__._Feature` |

<br />