Skip to content

Commit bad0d64

Browse files
authored
Merge branch 'master' into patch-19
2 parents f2997c5 + 8da374f commit bad0d64

27 files changed

+249
-244
lines changed

site/en/guide/migrate/metrics_optimizers.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
"\n",
145145
"def _model_fn(features, labels, mode):\n",
146146
" logits = tf1.layers.Dense(2)(features)\n",
147-
" predictions = tf.argmax(input=logits, axis=1)\n",
147+
" predictions = tf.math.argmax(input=logits, axis=1)\n",
148148
" loss = tf1.nn.sparse_softmax_cross_entropy_with_logits(labels=labels, logits=logits)\n",
149149
" optimizer = tf1.train.AdagradOptimizer(0.05)\n",
150150
" train_op = optimizer.minimize(loss, global_step=tf1.train.get_global_step())\n",
@@ -223,7 +223,7 @@
223223
"\n",
224224
"inputs = tf.keras.Input((2,))\n",
225225
"logits = tf.keras.layers.Dense(2)(inputs)\n",
226-
"predictions = tf.argmax(input=logits, axis=1)\n",
226+
"predictions = tf.math.argmax(input=logits, axis=1)\n",
227227
"model = tf.keras.models.Model(inputs, predictions)\n",
228228
"optimizer = tf.keras.optimizers.Adagrad(learning_rate=0.05)\n",
229229
"\n",

site/en/guide/migrate/upgrade.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
"source": [
9696
"## Compatibility modules\n",
9797
"\n",
98-
"Certain API symbols can not be upgraded simply by using a string replacement. Those that cannot be automatically upgraded will be mapped to their locations in the `compat.v1` module. This module replaces TF 1.x symbols like `tf.foo` with the equivalent `tf.compat.v1.foo` reference. If you are already using `compat.v1` APIs by importing TF via `import tensorflow.compat.v1 as tf`, the `tf_upgrade_v2` script will attempt to convert these usages to the non-compat APIs where possible. Note that while some `compat.v1` APIs are compatible with TF2.x behaviors, many are not. So, we recommend that you manually proofread replacements and migrate them to new APIs in the `tf.*` namespace instead of `tf.compat.v1` namespace as quickly as possible.\n",
98+
"Certain API symbols can not be upgraded simply by using a string replacement. Those that cannot be automatically upgraded will be mapped to their locations in the `compat.v1` module. This module replaces TF 1.x symbols like `tf.foo` with the equivalent `tf.compat.v1.foo` reference. If you are already using `compat.v1` APIs by importing TF via `import tensorflow.compat.v1 as tf`, the `tf_upgrade_v2` script will attempt to convert these usages to the non-compat APIs where possible. Note that while some `compat.v1` APIs are compatible with TF2.x behaviors, many are not. Therefore, it's recommended to manually proofread replacements and migrate them to new APIs in the `tf.*` namespace instead of `tf.compat.v1` namespace as quickly as possible.\n",
9999
"\n",
100100
"Because of TensorFlow 2.x module deprecations (for example, `tf.flags` and `tf.contrib`), some changes can not be worked around by switching to `compat.v1`. Upgrading this code may require using an additional library (for example, [`absl.flags`](https://github.com/abseil/abseil-py)) or switching to a package in [tensorflow/addons](http://www.github.com/tensorflow/addons).\n"
101101
]
@@ -574,7 +574,7 @@
574574
"source": [
575575
"## Caveats\n",
576576
"\n",
577-
"- Do not update parts of your code manually before running this script. In particular, functions that have had reordered arguments like `tf.argmax` or `tf.batch_to_space` cause the script to incorrectly add keyword arguments that mismap your existing code.\n",
577+
"- Do not update parts of your code manually before running this script. In particular, functions that have had reordered arguments like `tf.math.argmax` or `tf.batch_to_space` cause the script to incorrectly add keyword arguments that mismap your existing code.\n",
578578
"\n",
579579
"- The script assumes that `tensorflow` is imported using `import tensorflow as tf`, or `import tensorflow.compat.v1 as tf`.\n",
580580
"\n",

site/en/guide/ragged_tensor.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
"source": [
110110
"### What you can do with a ragged tensor\n",
111111
"\n",
112-
"Ragged tensors are supported by more than a hundred TensorFlow operations, including math operations (such as `tf.add` and `tf.reduce_mean`), array operations (such as `tf.concat` and `tf.tile`), string manipulation ops (such as `tf.substr`), control flow operations (such as `tf.while_loop` and `tf.map_fn`), and many others:"
112+
"Ragged tensors are supported by more than a hundred TensorFlow operations, including math operations (such as `tf.add` and `tf.reduce_mean`), array operations (such as `tf.concat` and `tf.tile`), string manipulation ops (such as `tf.strings.substr`), control flow operations (such as `tf.while_loop` and `tf.map_fn`), and many others:"
113113
]
114114
},
115115
{

site/en/guide/tensor.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@
368368
"# Find the largest value\n",
369369
"print(tf.reduce_max(c))\n",
370370
"# Find the index of the largest value\n",
371-
"print(tf.argmax(c))\n",
371+
"print(tf.math.argmax(c))\n",
372372
"# Compute the softmax\n",
373373
"print(tf.nn.softmax(c))"
374374
]

site/en/guide/variable.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
"source": [
167167
"print(\"A variable:\", my_variable)\n",
168168
"print(\"\\nViewed as a tensor:\", tf.convert_to_tensor(my_variable))\n",
169-
"print(\"\\nIndex of highest value:\", tf.argmax(my_variable))\n",
169+
"print(\"\\nIndex of highest value:\", tf.math.argmax(my_variable))\n",
170170
"\n",
171171
"# This creates a new tensor; it does not reshape the variable.\n",
172172
"print(\"\\nCopying and reshaping: \", tf.reshape(my_variable, [1,4]))"

site/en/install/lang_c.ipynb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,15 @@
8181
"id": "Vk--31hqIwSV"
8282
},
8383
"source": [
84-
"## Nightly Libtensorflow C packages\n",
84+
"## Nightly libtensorflow C packages\n",
8585
"\n",
86-
"Libtensorflow packages are built nightly and uploaded to GCS for all supported\n",
86+
"libtensorflow packages are built nightly and uploaded to GCS for all supported\n",
8787
"platforms. They are uploaded to the\n",
8888
"[libtensorflow-nightly GCS bucket](https://storage.googleapis.com/libtensorflow-nightly)\n",
8989
"and are indexed by operating system and date built. For MacOS and Linux shared\n",
90-
"objects, we have a\n",
90+
"objects, there is a\n",
9191
"[script](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/ci_build/builds/libtensorflow_nightly_symlink.sh)\n",
92-
"that renames the .so files versioned to the current date copied into the\n",
92+
"that renames the `.so` files versioned to the current date copied into the\n",
9393
"directory with the artifacts."
9494
]
9595
},
@@ -123,32 +123,32 @@
123123
"id": "y50y01XUFVb2"
124124
},
125125
"source": [
126-
"### Download & extract\n",
126+
"### Download and extract\n",
127127
"\n",
128128
"<table>\n",
129129
" <tr><th>TensorFlow C library</th><th>URL</th></tr>\n",
130130
" <tr class=\"alt\"><td colspan=\"2\">Linux</td></tr>\n",
131131
" <tr>\n",
132132
" <td>Linux CPU only</td>\n",
133-
" <td class=\"devsite-click-to-copy\"><a href=\"https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.7.0.tar.gz\">https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.7.0.tar.gz</a></td>\n",
133+
" <td class=\"devsite-click-to-copy\"><a href=\"https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.8.0.tar.gz\">https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.8.0.tar.gz</a></td>\n",
134134
" </tr>\n",
135135
" <tr>\n",
136136
" <td>Linux GPU support</td>\n",
137-
" <td class=\"devsite-click-to-copy\"><a href=\"https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-2.7.0.tar.gz\">https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-2.7.0.tar.gz</a></td>\n",
137+
" <td class=\"devsite-click-to-copy\"><a href=\"https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-2.8.0.tar.gz\">https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-2.8.0.tar.gz</a></td>\n",
138138
" </tr>\n",
139139
" <tr class=\"alt\"><td colspan=\"2\">macOS</td></tr>\n",
140140
" <tr>\n",
141141
" <td>macOS CPU only</td>\n",
142-
" <td class=\"devsite-click-to-copy\"><a href=\"https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-darwin-x86_64-2.7.0.tar.gz\">https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-darwin-x86_64-2.7.0.tar.gz</a></td>\n",
142+
" <td class=\"devsite-click-to-copy\"><a href=\"https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-darwin-x86_64-2.8.0.tar.gz\">https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-darwin-x86_64-2.8.0.tar.gz</a></td>\n",
143143
" </tr>\n",
144144
" <tr class=\"alt\"><td colspan=\"2\">Windows</td></tr>\n",
145145
" <tr>\n",
146146
" <td>Windows CPU only</td>\n",
147-
" <td class=\"devsite-click-to-copy\"><a href=\"https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.7.0.zip\">https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.7.0.zip</a></td>\n",
147+
" <td class=\"devsite-click-to-copy\"><a href=\"https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.8.0.zip\">https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.8.0.zip</a></td>\n",
148148
" </tr>\n",
149149
" <tr>\n",
150150
" <td>Windows GPU only</td>\n",
151-
" <td class=\"devsite-click-to-copy\"><a href=\"https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-windows-x86_64-2.7.0.zip\">https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-windows-x86_64-2.7.0.zip</a></td>\n",
151+
" <td class=\"devsite-click-to-copy\"><a href=\"https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-windows-x86_64-2.8.0.zip\">https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-windows-x86_64-2.8.0.zip</a></td>\n",
152152
" </tr>\n",
153153
"</table>"
154154
]
@@ -174,7 +174,7 @@
174174
"outputs": [],
175175
"source": [
176176
"%%bash\n",
177-
"FILENAME=libtensorflow-cpu-linux-x86_64-2.7.0.tar.gz\n",
177+
"FILENAME=libtensorflow-cpu-linux-x86_64-2.8.0.tar.gz\n",
178178
"wget -q --no-check-certificate https://storage.googleapis.com/tensorflow/libtensorflow/${FILENAME}\n",
179179
"sudo tar -C /usr/local -xzf ${FILENAME}"
180180
]

site/en/tutorials/audio/simple_audio.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@
563563
"source": [
564564
"def get_spectrogram_and_label_id(audio, label):\n",
565565
" spectrogram = get_spectrogram(audio)\n",
566-
" label_id = tf.argmax(label == commands)\n",
566+
" label_id = tf.math.argmax(label == commands)\n",
567567
" return spectrogram, label_id"
568568
]
569569
},

site/en/tutorials/audio/transfer_learning_audio.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@
286286
"source": [
287287
"scores, embeddings, spectrogram = yamnet_model(testing_wav_data)\n",
288288
"class_scores = tf.reduce_mean(scores, axis=0)\n",
289-
"top_class = tf.argmax(class_scores)\n",
289+
"top_class = tf.math.argmax(class_scores)\n",
290290
"inferred_class = class_names[top_class]\n",
291291
"\n",
292292
"print(f'The main sound is: {inferred_class}')\n",
@@ -736,7 +736,7 @@
736736
"outputs": [],
737737
"source": [
738738
"reloaded_results = reloaded_model(testing_wav_data)\n",
739-
"cat_or_dog = my_classes[tf.argmax(reloaded_results)]\n",
739+
"cat_or_dog = my_classes[tf.math.argmax(reloaded_results)]\n",
740740
"print(f'The main sound is: {cat_or_dog}')"
741741
]
742742
},
@@ -758,7 +758,7 @@
758758
"outputs": [],
759759
"source": [
760760
"serving_results = reloaded_model.signatures['serving_default'](testing_wav_data)\n",
761-
"cat_or_dog = my_classes[tf.argmax(serving_results['classifier'])]\n",
761+
"cat_or_dog = my_classes[tf.math.argmax(serving_results['classifier'])]\n",
762762
"print(f'The main sound is: {cat_or_dog}')\n"
763763
]
764764
},
@@ -805,13 +805,13 @@
805805
"# Run the model, check the output.\n",
806806
"scores, embeddings, spectrogram = yamnet_model(waveform)\n",
807807
"class_scores = tf.reduce_mean(scores, axis=0)\n",
808-
"top_class = tf.argmax(class_scores)\n",
808+
"top_class = tf.math.argmax(class_scores)\n",
809809
"inferred_class = class_names[top_class]\n",
810810
"top_score = class_scores[top_class]\n",
811811
"print(f'[YAMNet] The main sound is: {inferred_class} ({top_score})')\n",
812812
"\n",
813813
"reloaded_results = reloaded_model(waveform)\n",
814-
"your_top_class = tf.argmax(reloaded_results)\n",
814+
"your_top_class = tf.math.argmax(reloaded_results)\n",
815815
"your_inferred_class = my_classes[your_top_class]\n",
816816
"class_probabilities = tf.nn.softmax(reloaded_results, axis=-1)\n",
817817
"your_top_score = class_probabilities[your_top_class]\n",

site/en/tutorials/customization/custom_training_walkthrough.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@
475475
},
476476
"outputs": [],
477477
"source": [
478-
"print(\"Prediction: {}\".format(tf.argmax(predictions, axis=1)))\n",
478+
"print(\"Prediction: {}\".format(tf.math.argmax(predictions, axis=1)))\n",
479479
"print(\" Labels: {}\".format(labels))"
480480
]
481481
},
@@ -824,7 +824,7 @@
824824
" # training=False is needed only if there are layers with different\n",
825825
" # behavior during training versus inference (e.g. Dropout).\n",
826826
" logits = model(x, training=False)\n",
827-
" prediction = tf.argmax(logits, axis=1, output_type=tf.int64)\n",
827+
" prediction = tf.math.argmax(logits, axis=1, output_type=tf.int64)\n",
828828
" test_accuracy(prediction, y)\n",
829829
"\n",
830830
"print(\"Test set accuracy: {:.3%}\".format(test_accuracy.result()))"
@@ -895,7 +895,7 @@
895895
"predictions = model(predict_dataset, training=False)\n",
896896
"\n",
897897
"for i, logits in enumerate(predictions):\n",
898-
" class_idx = tf.argmax(logits).numpy()\n",
898+
" class_idx = tf.math.argmax(logits).numpy()\n",
899899
" p = tf.nn.softmax(logits)[class_idx]\n",
900900
" name = class_names[class_idx]\n",
901901
" print(\"Example {} prediction: {} ({:4.1f}%)\".format(i, name, 100*p))"

site/en/tutorials/images/segmentation.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@
507507
"outputs": [],
508508
"source": [
509509
"def create_mask(pred_mask):\n",
510-
" pred_mask = tf.argmax(pred_mask, axis=-1)\n",
510+
" pred_mask = tf.math.argmax(pred_mask, axis=-1)\n",
511511
" pred_mask = pred_mask[..., tf.newaxis]\n",
512512
" return pred_mask[0]"
513513
]

0 commit comments

Comments
 (0)