Help protect the Great Barrier Reef with TensorFlow on Kaggle Join Challenge


View source on GitHub

Context manager for grouping async operations.

Ops/function calls inside the scope can return before finishing the actual execution. When exiting the async scope, a synchronization barrier will be automatically added to ensure the completion of all async op and function execution, potentially raising exceptions if async execution results in an error state.

Users may write the following code to asynchronuously invoke train_step_fn and log the loss metric for every num_steps steps in a training loop. train_step_fn internally consumes data using iterator.get_next(), and may throw OutOfRangeError when running out of data. In the case:

  with tf.experimental.async_scope():
    for _ in range(num_steps):
      # Step function updates the metric `loss` internally
except tf.errors.OutOfRangeError:
  tf.experimental.async_clear_error()'loss =', loss.numpy())


Context manager for grouping async operations.