Skip to content

Commit bd1c161

Browse files
Merge pull request #2330 from tilakrayal:patch-17
PiperOrigin-RevId: 686262704
2 parents a1137cb + 2cafc4b commit bd1c161

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Diff for: site/en/tutorials/keras/text_classification_with_hub.ipynb

+7-5
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@
121121
"outputs": [],
122122
"source": [
123123
"!pip install tensorflow-hub\n",
124-
"!pip install tensorflow-datasets"
124+
"!pip install tensorflow-datasets\n",
125+
"!pip install tf-keras"
125126
]
126127
},
127128
{
@@ -138,6 +139,7 @@
138139
"import tensorflow as tf\n",
139140
"import tensorflow_hub as hub\n",
140141
"import tensorflow_datasets as tfds\n",
142+
"import tf_keras as keras\n",
141143
"\n",
142144
"print(\"Version: \", tf.__version__)\n",
143145
"print(\"Eager mode: \", tf.executing_eagerly())\n",
@@ -290,10 +292,10 @@
290292
},
291293
"outputs": [],
292294
"source": [
293-
"model = tf.keras.Sequential()\n",
295+
"model = keras.Sequential()\n",
294296
"model.add(hub_layer)\n",
295-
"model.add(tf.keras.layers.Dense(16, activation='relu'))\n",
296-
"model.add(tf.keras.layers.Dense(1))\n",
297+
"model.add(keras.layers.Dense(16, activation='relu'))\n",
298+
"model.add(keras.layers.Dense(1))\n",
297299
"\n",
298300
"model.summary()"
299301
]
@@ -339,7 +341,7 @@
339341
"outputs": [],
340342
"source": [
341343
"model.compile(optimizer='adam',\n",
342-
" loss=tf.keras.losses.BinaryCrossentropy(from_logits=True),\n",
344+
" loss=keras.losses.BinaryCrossentropy(from_logits=True),\n",
343345
" metrics=['accuracy'])"
344346
]
345347
},

0 commit comments

Comments
 (0)