(self, tpu_context=None)
return seed
Returns the dataset seed for according to the TPUContext.

    On CPU/GPU it returns the default seed. For TPUs the input_fn is executed
    on every host machine (if per-host input is set, which is set by default).
    We use a different (but deterministically computed) random seed on each host
    to ensure each host machine sees a different stream of input data.

    Args:
      tpu_context: TPU execution context.

    Returns:
      The current seed if CPU/GPU and a host-specific seed for TPU.
Returns the dataset seed for according to the TPUContext.
Returns the dataset seed for according to the TPUContext .
def _get_per_host_random_seed(self, tpu_context=None):
    """Returns the dataset seed for according to the TPUContext.

    On CPU/GPU it returns the default seed. For TPUs the input_fn is executed
    on every host machine (if per-host input is set, which is set by default).
    We use a different (but deterministically computed) random seed on each host
    to ensure each host machine sees a different stream of input data.

    Args:
      tpu_context: TPU execution context.

    Returns:
      The current seed if CPU/GPU and a host-specific seed for TPU.
    """
    if self._seed is None:
      logging.warning("Dataset seed not set.")
      return None
    if tpu_context is None:
      logging.warning("No TPUContext, using unmodified dataset seed %s.",
                      self._seed)
      return self._seed
    seed = self._seed + tpu_context.current_host
    logging.info("Running with %d hosts, modifying dataset seed for "
                 "host %d to %s.", tpu_context.num_hosts,
                 tpu_context.current_host, seed)
    return seed
def _get_per_host_random_seed ( self , tpu_context = None ) : if self . _seed is None : logging . warning ( "Dataset seed not set." ) return None if tpu_context is None : logging . warning ( "No TPUContext, using unmodified dataset seed %s." , self . _seed ) return self . _seed seed = self . _seed + tpu_context . current_host logging . info ( "Running with %d hosts, modifying dataset seed for " "host %d to %s." , tpu_context . num_hosts , tpu_context . current_host , seed ) return seed