message: Fix the epoch loss calculation
diff: "source": [
  "BUFFER_SIZE = len(input_tensor_train)\n",
  "BATCH_SIZE = 64\n",
  + "N_BATCH = BUFFER_SIZE//BATCH_SIZE\n",
  "embedding_dim = 256\n",
  "units = 1024\n",
  "vocab_inp_size = len(inp_lang.word2idx)\n",
  " # using teacher forcing\n",
  " dec_input = tf.expand_dims(targ[:, t], 1)\n",
  " \n",
  - " total_loss += (loss / int(targ.shape[1]))\n",
  - " \n",
  " variables = encoder.variables + decoder.variables\n",
  " \n",
  " gradients = tape.gradient(loss, variables)\n",
  " \n",
  " optimizer.apply_gradients(zip(gradients, variables), tf.train.get_or_create_global_step())\n",
  " \n",
  + " batch_loss += (loss / int(targ.shape[1]))\n",
  + " \n",
  + " total_loss += batch_loss\n",
  + " \n",
  " if batch % 100 == 0:\n",
  " print('Epoch {} Batch {} Loss {:.4f}'.format(epoch + 1,\n",
  " batch,\n",
  - " loss.numpy() / int(targ.shape[1])))\n",
  + " batch_loss.numpy()))\n",
  " \n",
  " print('Epoch {} Loss {:.4f}'.format(epoch + 1,\n",
  - " total_loss/len(input_tensor)))\n",
  + " total_loss/N_BATCH))\n",
  " print('Time taken for 1 epoch {} sec\\n'.format(time.time() - start))"
  ],
  "execution_count": 0,
  