Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

‎site/en/tutorials/keras/text_classification_with_hub.ipynb

Lines changed: 7 additions & 5 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /