message: Adding defun
diff: "source": [
  "This notebook demonstrates how to generate images of handwritten digits using [tf.keras](https://www.tensorflow.org/programmers_guide/keras) and [eager execution](https://www.tensorflow.org/programmers_guide/eager). To do so, we use Deep Convolutional Generative Adverserial Networks ([DCGAN](https://arxiv.org/pdf/1511.06434.pdf)).\n",
  "\n",
  - "This model takes about 40 seconds per epoch to train on a single Tesla K80 on Colab, as of July 2018.\n",
  + "This model takes about ~30 seconds per epoch (using tf.contrib.eager.defun to create graph functions) to train on a single Tesla K80 on Colab, as of July 2018.\n",
  "\n",
  "Below is the output generated after training the generator and discriminator models for 150 epochs.\n",
  "\n",
  "## Write the generator and discriminator models\n",
  "\n",
  "* **Generator** \n",
  - " * It is responsible for **creating the convincing images good enough to fool the discriminator**.\n",
  + " * It is responsible for **creating convincing images that are good enough to fool the discriminator**.\n",
  " * It consists of Conv2DTranspose (Upsampling) layers. We start with a fully connected layer and upsample the image 2 times so as to reach the desired image size (mnist image size) which is (28, 28, 1). \n",
  " * We use **leaky relu** activation except for the **last layer** which uses **tanh** activation.\n",
  " \n",
  "discriminator = Discriminator()"
  ]
  },
  + {
  + "cell_type": "code",
  + "execution_count": 0,
  + "metadata": {
  + "colab": {
  + "autoexec": {
  + "startup": false,
  + "wait_interval": 0
  + }
  + },
  + "colab_type": "code",
  + "id": "k1HpMSLImuRi"
  + },
  + "outputs": [],
  + "source": [
  + "# Defun gives 10 secs/epoch performance boost\n",
  + "generator.call = tf.contrib.eager.defun(generator.call)\n",
  + "discriminator.call = tf.contrib.eager.defun(discriminator.call)"
  + ]
  + },
  {
  "cell_type": "markdown",
  "metadata": {
  