Skip to content

Commit

Permalink
add a note about keras in tensorflow >= 1.4 (rasbt#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
rasbt authored Nov 3, 2017
1 parent 063b673 commit 0cbbbfa
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
12 changes: 12 additions & 0 deletions code/ch13/ch13.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,18 @@
"import tensorflow as tf\n",
"import tensorflow.contrib.keras as keras\n",
"\n",
"# NOTE:\n",
"# ================================================\n",
"# If you have TensorFlow >= v1.4 installed\n",
"# you can use the keras API directly instead\n",
"# of importing it from the contrib module\n",
"# for instance, in this code cell, you can skip\n",
"# the import, and following code cells,\n",
"# you can use \n",
"# `tf.keras.utils.to_categorical(y_train)`\n",
"# instead of `keras.utils.to_categorical(y_train)`\n",
"# and so forth.\n",
"\n",
"np.random.seed(123)\n",
"tf.set_random_seed(123)"
]
Expand Down
14 changes: 14 additions & 0 deletions code/ch13/ch13.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@
import struct
import tensorflow.contrib.keras as keras

# NOTE:
# ================================================
# If you have TensorFlow >= v1.4 installed
# you can use the keras API directly instead
# of importing it from the contrib module
# for instance, in this code cell, you can skip
# the import, and following code cells,
# you can use
# `tf.keras.utils.to_categorical(y_train)`
# instead of `keras.utils.to_categorical(y_train)`
# and so forth.



# *Python Machine Learning 2nd Edition* by [Sebastian Raschka](https://sebastianraschka.com) and Vahid Mirjalili, Packt Publishing Ltd. 2017
#
# Code Repository: https://github.com/rasbt/python-machine-learning-book-2nd-edition
Expand Down

0 comments on commit 0cbbbfa

Please sign in to comment.