Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tools/colab/shakespeare_with_tpu_and_keras.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@
" \n",
" # sample from our output distribution\n",
" next_idx = [\n",
" np.random.choice(256, p=next_probits[i])\n",
" [np.random.choice(256, p=next_probits[i])]\n",
" for i in range(BATCH_SIZE)\n",
" ]\n",
" predictions.append(np.asarray(next_idx, dtype=np.int32))\n",
Expand All @@ -432,7 +432,7 @@
"for i in range(BATCH_SIZE):\n",
" print('PREDICTION %d\\n\\n' % i)\n",
" p = [predictions[j][i] for j in range(PREDICT_LEN)]\n",
" generated = ''.join([chr(c) for c in p]) # Convert back to text\n",
" generated = ''.join([chr(c[0]) for c in p]) # Convert back to text\n",
" print(generated)\n",
" print()\n",
" assert len(generated) == PREDICT_LEN, 'Generated text too short'"
Expand Down