tf.distribute.InputContext

View source on GitHub

A class wrapping information needed by an input function.

tf.distribute.InputContext(
    num_input_pipelines=1, input_pipeline_id=0, num_replicas_in_sync=1
)

This is a context class that is passed to the user's input function and contains information about the compute replicas and input pipelines. The number of compute replicas (in sync training) helps compute the local batch size from the desired global batch size for each replica. The input pipeline information can be used to return a different subset of the input in each replica (for e.g. shard the input pipeline, use a different input source etc).

Args:

Attributes:

Methods

get_per_replica_batch_size

View source

get_per_replica_batch_size(
    global_batch_size
)

Returns the per-replica batch size.

Args:

Returns:

the per-replica batch size.

Raises: