pythontensorflowgoogle-colaboratoryeager

Tensorflow Eager Execution on Colab


I'm trying to enable eager execution with Tensorflow on a Colab notebook but I get an error message:

import tensorflow as tf
import tensorflow.contrib.eager as tfe

tf.enable_eager_execution()

ValueError: tf.enable_eager_execution must be called at program startup

I tried to click "reset runtime" in order to run tf.enable_eager_execution at startup but the error rises again.

Opening a different notebook didn't help.

What can I do in Colab in order to allow eager execution after this error rises?

Thanks.


Solution

  • This was a bug on our side, fix is now live, and the original code snippet should be working again. See Tensorflow eager mode dose not work when GPU is enabled in google colab · Issue #262 · googlecolab/colabtools.

    (NB: I'm on the Google Colaboratory team.)