Skip to content

Commit c122ccf

Browse files
PiperOrigin-RevId: 499589900
1 parent 881afa3 commit c122ccf

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

site/en/tutorials/quickstart/beginner.ipynb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
"\n",
126126
"## Load a dataset\n",
127127
"\n",
128-
"Load and prepare the [MNIST dataset](http://yann.lecun.com/exdb/mnist/). Convert the sample data from integers to floating-point numbers:"
128+
"Load and prepare the [MNIST dataset](http://yann.lecun.com/exdb/mnist/). The pixel values of the images range from 0 through 255. Scale these values to a range of 0 to 1 by dividing the values by `255.0`. This also converts the sample data from integers to floating-point numbers:"
129129
]
130130
},
131131
{
@@ -150,7 +150,7 @@
150150
"source": [
151151
"## Build a machine learning model\n",
152152
"\n",
153-
"Build a `tf.keras.Sequential` model by stacking layers."
153+
"Build a `tf.keras.Sequential` model:"
154154
]
155155
},
156156
{
@@ -175,6 +175,8 @@
175175
"id": "l2hiez2eIUz8"
176176
},
177177
"source": [
178+
"[`Sequential`](https://www.tensorflow.org/guide/keras/sequential_model) is useful for stacking layers where each layer has one input [tensor](https://www.tensorflow.org/guide/tensor) and one output tensor. Layers are functions with a known mathematical structure that can be reused and have trainable variables. Most TensorFlow models are composed of layers. This model uses the [`Flatten`](https://www.tensorflow.org/api_docs/python/tf/keras/layers/Flatten), [`Dense`](https://www.tensorflow.org/api_docs/python/tf/keras/layers/Dense), and [`Dropout`](https://www.tensorflow.org/api_docs/python/tf/keras/layers/Dropout) layers.\n",
179+
"\n",
178180
"For each example, the model returns a vector of [logits](https://developers.google.com/machine-learning/glossary#logits) or [log-odds](https://developers.google.com/machine-learning/glossary#log-odds) scores, one for each class."
179181
]
180182
},
@@ -225,7 +227,7 @@
225227
"id": "hQyugpgRIyrA"
226228
},
227229
"source": [
228-
"Define a loss function for training using `losses.SparseCategoricalCrossentropy`, which takes a vector of logits and a `True` index and returns a scalar loss for each example."
230+
"Define a loss function for training using `losses.SparseCategoricalCrossentropy`:"
229231
]
230232
},
231233
{
@@ -245,7 +247,7 @@
245247
"id": "SfR4MsSDU880"
246248
},
247249
"source": [
248-
"This loss is equal to the negative log probability of the true class: The loss is zero if the model is sure of the correct class.\n",
250+
"The loss function takes a vector of ground truth values and a vector of logits and returns a scalar loss for each example. This loss is equal to the negative log probability of the true class: The loss is zero if the model is sure of the correct class.\n",
249251
"\n",
250252
"This untrained model gives probabilities close to random (1/10 for each class), so the initial loss should be close to `-tf.math.log(1/10) ~= 2.3`."
251253
]

0 commit comments

Comments
 (0)