# Module: tf.contrib.tpu

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/tpu/__init__.py) |

Ops related to Tensor Processing Units.

## Modules

[`profiler`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/tpu/profiler) module: Stub file to maintain backwards compatibility.

## Classes

[`class AsyncCheckpointSaverHook`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/tpu/AsyncCheckpointSaverHook): Saves checkpoints every N steps or seconds.

[`class CrossShardOptimizer`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/tpu/CrossShardOptimizer): An optimizer that averages gradients across TPU shards.

[`class DeviceAssignment`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/tpu/experimental/DeviceAssignment): Mapping from logical cores in a computation to the physical TPU topology.

[`class InfeedQueue`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/tpu/InfeedQueue): A helper object to build a device infeed queue.

[`class InputPipelineConfig`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/estimator/tpu/InputPipelineConfig): Please see the definition of these values in TPUConfig.

[`class RunConfig`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/estimator/tpu/RunConfig): RunConfig with TPU support.

[`class TPUConfig`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/estimator/tpu/TPUConfig): TPU related configuration required by `TPUEstimator`.

[`class TPUDistributionStrategy`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/tpu/TPUDistributionStrategy): The strategy to run Keras model on TPU.

[`class TPUEstimator`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/estimator/tpu/TPUEstimator): Estimator with TPU support.

[`class TPUEstimatorSpec`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/estimator/tpu/TPUEstimatorSpec): Ops and objects returned from a `model_fn` and passed to `TPUEstimator`.

[`class Topology`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/tpu/Topology): Describes a set of TPU devices.

## Functions

[`batch_parallel(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/tpu/batch_parallel): Shards `computation` along the batch dimension for parallel execution.

[`bfloat16_scope(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/tpu/bfloat16_scope): Scope class for bfloat16 variables so that the model uses custom getter.

[`core(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/tpu/core): Returns the device name for a core in a replicated TPU computation.

[`cross_replica_sum(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/tpu/cross_replica_sum): Sum the input tensor across replicas according to group_assignment.

[`device_assignment(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/tpu/device_assignment): Computes a device_assignment of a computation across a TPU topology.

[`export_estimator_savedmodel(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/tpu/export_estimator_savedmodel): Export `Estimator` trained model for TPU inference.

[`infeed_dequeue(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/tpu/infeed_dequeue): A placeholder op for a value that will be fed into the computation.

[`infeed_dequeue_tuple(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/tpu/infeed_dequeue_tuple): A placeholder op for values fed into the TPU simultaneously as a tuple.

[`infeed_enqueue(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/tpu/infeed_enqueue): An op which feeds a single Tensor value into the computation.

[`infeed_enqueue_tuple(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/tpu/infeed_enqueue_tuple): Feeds multiple Tensor values into the computation as an XLA tuple.

[`initialize_system(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/tpu/initialize_system): Initializes a distributed TPU system for use with TensorFlow.

[`keras_to_tpu_model(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/tpu/keras_to_tpu_model): Copy `model` along with weights to the TPU. (deprecated)

[`outfeed_dequeue(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/tpu/outfeed_dequeue): Retrieves a single tensor from the computation outfeed.

[`outfeed_dequeue_tuple(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/tpu/outfeed_dequeue_tuple): Retrieve multiple values from the computation outfeed.

[`outfeed_enqueue(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/tpu/outfeed_enqueue): Enqueue a Tensor on the computation outfeed.

[`outfeed_enqueue_tuple(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/tpu/outfeed_enqueue_tuple): Enqueue multiple Tensor values on the computation outfeed.

[`outside_compilation(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/tpu/outside_compilation): Builds part of a computation outside any current TPU replicate scope.

[`repeat(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/tpu/repeat): Builds a training loop that executes a fixed number of iterations.

[`replicate(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/tpu/replicate): Builds a graph operator that runs a replicated TPU computation.

[`rewrite(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/tpu/rewrite): Rewrites `computation` for execution on a TPU system.

[`shard(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/tpu/shard): Shards `computation` for parallel execution.

[`shutdown_system(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/tpu/shutdown_system): Shuts down a running a distributed TPU system.

[`while_loop(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/tpu/while_loop): Builds a training loop for TPUs.