Skip to content

Commit b763c61

Browse files
AleksMattensorflower-gardener
authored andcommitted
Replace unicode escaped characters in ipynb files
PiperOrigin-RevId: 854213760
1 parent f7ca75b commit b763c61

14 files changed

+649
-649
lines changed

examples/notebooks/graph_network_shortest_path.ipynb

Lines changed: 349 additions & 349 deletions
Large diffs are not rendered by default.

examples/notebooks/intro_mutag_example.ipynb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@
4747
"id": "yzRjo2fLu9A1"
4848
},
4949
"source": [
50-
"\u003ctable class=\"tfo-notebook-buttons\" align=\"left\"\u003e\n",
51-
" \u003ctd\u003e\n",
52-
" \u003ctd\u003e\n",
53-
" \u003ca target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/gnn/blob/master/examples/notebooks/intro_mutag_example.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" /\u003eRun in Google Colab\u003c/a\u003e\n",
54-
" \u003c/td\u003e\n",
55-
" \u003ctd\u003e\n",
56-
" \u003ca target=\"_blank\" href=\"https://github.com/tensorflow/gnn/blob/main/examples/notebooks/intro_mutag_example.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" /\u003eView on GitHub\u003c/a\u003e\n",
57-
" \u003c/td\u003e\n",
58-
"\u003c/table\u003e"
50+
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
51+
" <td>\n",
52+
" <td>\n",
53+
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/gnn/blob/master/examples/notebooks/intro_mutag_example.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
54+
" </td>\n",
55+
" <td>\n",
56+
" <a target=\"_blank\" href=\"https://github.com/tensorflow/gnn/blob/main/examples/notebooks/intro_mutag_example.ipynb\"><img src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" />View on GitHub</a>\n",
57+
" </td>\n",
58+
"</table>"
5959
]
6060
},
6161
{

examples/notebooks/ogbn_mag_e2e.ipynb

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@
4747
"id": "ev9vJpM94c3i"
4848
},
4949
"source": [
50-
"\u003ctable class=\"tfo-notebook-buttons\" align=\"left\"\u003e\n",
51-
" \u003ctd\u003e\n",
52-
" \u003ctd\u003e\n",
53-
" \u003ca target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/gnn/blob/master/examples/notebooks/ogbn_mag_e2e.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" /\u003eRun in Google Colab\u003c/a\u003e\n",
54-
" \u003c/td\u003e\n",
55-
" \u003ctd\u003e\n",
56-
" \u003ca target=\"_blank\" href=\"https://github.com/tensorflow/gnn/blob/main/examples/notebooks/ogbn_mag_e2e.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" /\u003eView on GitHub\u003c/a\u003e\n",
57-
" \u003c/td\u003e\n",
58-
"\u003c/table\u003e"
50+
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
51+
" <td>\n",
52+
" <td>\n",
53+
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/gnn/blob/master/examples/notebooks/ogbn_mag_e2e.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
54+
" </td>\n",
55+
" <td>\n",
56+
" <a target=\"_blank\" href=\"https://github.com/tensorflow/gnn/blob/main/examples/notebooks/ogbn_mag_e2e.ipynb\"><img src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" />View on GitHub</a>\n",
57+
" </td>\n",
58+
"</table>"
5959
]
6060
},
6161
{
@@ -183,7 +183,7 @@
183183
"\n",
184184
"OGBN-MAG defines a split of node set \"papers\" into **train, validation and test nodes**, based on its \"year\" feature:\n",
185185
"\n",
186-
" * \"train\" has the 629,571 papers with `year\u003c=2017`,\n",
186+
" * \"train\" has the 629,571 papers with `year<=2017`,\n",
187187
" * \"validation\" has the 64,879 papers with `year==2018`, and\n",
188188
" * \"test\" has the 41,939 papers with `year==2019`.\n",
189189
"\n",
@@ -301,7 +301,7 @@
301301
"\n",
302302
"def create_sampling_model(\n",
303303
" full_graph_tensor: tfgnn.GraphTensor, sizes: Mapping[str, int]\n",
304-
") -\u003e tf.keras.Model:\n",
304+
") -> tf.keras.Model:\n",
305305
"\n",
306306
" def edge_sampler(sampling_op: tfgnn.sampler.SamplingOp):\n",
307307
" edge_set_name = sampling_op.edge_set_name\n",
@@ -363,10 +363,10 @@
363363
},
364364
"outputs": [],
365365
"source": [
366-
"def seed_dataset(years: tf.Tensor, split_name: str) -\u003e tf.data.Dataset:\n",
366+
"def seed_dataset(years: tf.Tensor, split_name: str) -> tf.data.Dataset:\n",
367367
" \"\"\"Seed dataset as indices of papers within split years.\"\"\"\n",
368368
" if split_name == \"train\":\n",
369-
" mask = years \u003c= 2017 # 629,571 examples\n",
369+
" mask = years <= 2017 # 629,571 examples\n",
370370
" elif split_name == \"validation\":\n",
371371
" mask = years == 2018 # 64,879 examples\n",
372372
" elif split_name == \"test\":\n",
@@ -408,7 +408,7 @@
408408
" self._split_name = split_name\n",
409409
" self.input_graph_spec = self._sampling_model.output.spec\n",
410410
"\n",
411-
" def get_dataset(self, context: tf.distribute.InputContext) -\u003e tf.data.Dataset:\n",
411+
" def get_dataset(self, context: tf.distribute.InputContext) -> tf.data.Dataset:\n",
412412
" \"\"\"Creates TF dataset.\"\"\"\n",
413413
" self._seed_dataset = seed_dataset(self._years, self._split_name)\n",
414414
" ds = self._seed_dataset.shard(\n",
@@ -424,7 +424,7 @@
424424
" )\n",
425425
" return ds.unbatch().prefetch(tf.data.AUTOTUNE)\n",
426426
"\n",
427-
" def sample(self, seeds: tf.Tensor) -\u003e tfgnn.GraphTensor:\n",
427+
" def sample(self, seeds: tf.Tensor) -> tfgnn.GraphTensor:\n",
428428
" seeds = tf.cast(seeds, tf.int64)\n",
429429
" batch_size = tf.size(seeds)\n",
430430
" # samples subgraphs for each seed independently as [[seed1], [seed2], ...]\n",
@@ -787,7 +787,7 @@
787787
" units=node_state_dim,\n",
788788
" message_dim=message_dim,\n",
789789
" receiver_tag=tfgnn.SOURCE,\n",
790-
" node_set_names=None if i \u003c num_graph_updates-1 else [\"paper\"],\n",
790+
" node_set_names=None if i < num_graph_updates-1 else [\"paper\"],\n",
791791
" simple_conv_reduce_type=\"mean|sum\",\n",
792792
" state_dropout_rate=state_dropout_rate,\n",
793793
" l2_regularization=l2_regularization,\n",
@@ -879,7 +879,7 @@
879879
" model_dir=\"/tmp/gnn_model/\",\n",
880880
" callbacks=None,\n",
881881
" steps_per_epoch=steps_per_epoch,\n",
882-
" validation_steps=validation_steps, # \u003c\u003c\u003c Remove if not training for real.\n",
882+
" validation_steps=validation_steps, # <<< Remove if not training for real.\n",
883883
" restore_best_weights=False,\n",
884884
" checkpoint_every_n_steps=\"never\",\n",
885885
" summarize_every_n_steps=\"never\",\n",
@@ -976,7 +976,7 @@
976976
{
977977
"data": {
978978
"text/plain": [
979-
"RunResult(preprocess_model=\u003ckeras.src.engine.functional.Functional object at 0x7fed485eee90\u003e, base_model=\u003ckeras.src.engine.sequential.Sequential object at 0x7febfa0b3280\u003e, trained_model=\u003ckeras.src.engine.functional.Functional object at 0x7fec8811a9e0\u003e)"
979+
"RunResult(preprocess_model=<keras.src.engine.functional.Functional object at 0x7fed485eee90>, base_model=<keras.src.engine.sequential.Sequential object at 0x7febfa0b3280>, trained_model=<keras.src.engine.functional.Functional object at 0x7fec8811a9e0>)"
980980
]
981981
},
982982
"execution_count": 17,
@@ -989,8 +989,8 @@
989989
" gtspec=example_input_graph_spec,\n",
990990
" train_ds_provider=train_ds_provider,\n",
991991
" train_padding=train_padding,\n",
992-
" valid_ds_provider=valid_ds_provider, # \u003c\u003c\u003c Remove if not training for real.\n",
993-
" valid_padding=valid_padding, # \u003c\u003c\u003c Remove if not training for real.\n",
992+
" valid_ds_provider=valid_ds_provider, # <<< Remove if not training for real.\n",
993+
" valid_padding=valid_padding, # <<< Remove if not training for real.\n",
994994
" global_batch_size=global_batch_size,\n",
995995
" epochs=epochs,\n",
996996
" feature_processors=feature_processors,\n",

examples/notebooks/ogbn_mag_indepth.ipynb

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@
4747
"id": "ev9vJpM94c3i"
4848
},
4949
"source": [
50-
"\u003ctable class=\"tfo-notebook-buttons\" align=\"left\"\u003e\n",
51-
" \u003ctd\u003e\n",
52-
" \u003ctd\u003e\n",
53-
" \u003ca target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/gnn/blob/master/examples/notebooks/ogbn_mag_indepth.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" /\u003eRun in Google Colab\u003c/a\u003e\n",
54-
" \u003c/td\u003e\n",
55-
" \u003ctd\u003e\n",
56-
" \u003ca target=\"_blank\" href=\"https://github.com/tensorflow/gnn/blob/main/examples/notebooks/ogbn_mag_indepth.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" /\u003eView on GitHub\u003c/a\u003e\n",
57-
" \u003c/td\u003e\n",
58-
"\u003c/table\u003e"
50+
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
51+
" <td>\n",
52+
" <td>\n",
53+
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/gnn/blob/master/examples/notebooks/ogbn_mag_indepth.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
54+
" </td>\n",
55+
" <td>\n",
56+
" <a target=\"_blank\" href=\"https://github.com/tensorflow/gnn/blob/main/examples/notebooks/ogbn_mag_indepth.ipynb\"><img src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" />View on GitHub</a>\n",
57+
" </td>\n",
58+
"</table>"
5959
]
6060
},
6161
{
@@ -154,7 +154,7 @@
154154
"\n",
155155
"OGBN-MAG is [Open Graph Benchmark](https://ogb.stanford.edu)'s Node classification task on a subset of the [Microsoft Academic Graph](https://www.microsoft.com/en-us/research/publication/microsoft-academic-graph-when-experts-are-not-enough/). The [basic tutorial](https://colab.research.google.com/github/tensorflow/gnn/blob/master/examples/notebooks/ogbn_mag_e2e.ipynb) has explained the dataset and the task in detail. To recap, the OGBN-MAG dataset is one big graph with node sets \"paper\", \"field_of_study\", \"author\", and \"institution\" and edge sets \"cites\", \"has_topic\", \"writes\", and \"affiliated_with\", each connecting two particular node sets.\n",
156156
"\n",
157-
"The task is to **predict the venue** (journal or conference, not represented in the graph itself) at which each of the papers has been published. Based on their \"year\" feature, the \"paper\" nodes are split into \"train\" (`year\u003c=2017`), \"validation\" (`year==2018`), and \"test\"(`year==2019`).\n"
157+
"The task is to **predict the venue** (journal or conference, not represented in the graph itself) at which each of the papers has been published. Based on their \"year\" feature, the \"paper\" nodes are split into \"train\" (`year<=2017`), \"validation\" (`year==2018`), and \"test\"(`year==2019`).\n"
158158
]
159159
},
160160
{
@@ -447,7 +447,7 @@
447447
" # For gs://download.tensorflow.org, we avoid listing it and do\n",
448448
" filenames = _glob_sharded(file_pattern)\n",
449449
" ds = tf.data.Dataset.from_tensor_slices(filenames)\n",
450-
" if input_context and input_context.num_input_pipelines \u003e 1:\n",
450+
" if input_context and input_context.num_input_pipelines > 1:\n",
451451
" ds = ds.shard(input_context.num_input_pipelines,\n",
452452
" input_context.input_pipeline_id)\n",
453453
" if shuffle:\n",
@@ -680,7 +680,7 @@
680680
" years = tf.io.parse_single_example(serialized_example, features)[\"years\"]\n",
681681
" year = years[0] # By convention, the root node is the first node.\n",
682682
" if split_name == \"train\": # 629,571\n",
683-
" return year \u003c= 2017\n",
683+
" return year <= 2017\n",
684684
" elif split_name == \"validation\": # 64,879\n",
685685
" return year == 2018\n",
686686
" elif split_name == \"test\": # 41,939\n",
@@ -762,7 +762,7 @@
762762
{
763763
"data": {
764764
"text/plain": [
765-
"\u003ctf.Tensor: shape=(30, 1), dtype=int64, numpy=\n",
765+
"<tf.Tensor: shape=(30, 1), dtype=int64, numpy=\n",
766766
"array([[193],\n",
767767
" [265],\n",
768768
" [ 56],\n",
@@ -792,7 +792,7 @@
792792
" [236],\n",
793793
" [265],\n",
794794
" [193],\n",
795-
" [277]])\u003e"
795+
" [277]])>"
796796
]
797797
},
798798
"execution_count": 11,
@@ -847,12 +847,12 @@
847847
"name": "stdout",
848848
"output_type": "stream",
849849
"text": [
850-
"\u003ctf.RaggedTensor [[0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n",
851-
" [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]\u003e\n",
852-
"\u003ctf.RaggedTensor [[20],\n",
850+
"<tf.RaggedTensor [[0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n",
851+
" [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]>\n",
852+
"<tf.RaggedTensor [[20],\n",
853853
" [11, 90, 144, 167, 181, 196, 199, 201, 228, 264, 267, 287, 376, 401],\n",
854854
" [32, 88, 111, 175, 211, 235, 301, 309, 311, 350, 377, 521, 631, 688, 693,\n",
855-
" 723, 760, 770, 788, 795, 940, 1100, 1127] ]\u003e\n"
855+
" 723, 760, 770, 788, 795, 940, 1100, 1127] ]>\n"
856856
]
857857
}
858858
],
@@ -1355,8 +1355,8 @@
13551355
"name": "stderr",
13561356
"output_type": "stream",
13571357
"text": [
1358-
"WARNING:tensorflow:Mapping types may not work well with tf.nest. Prefer using MutableMapping for \u003cclass 'tensorflow_gnn.graph.graph_tensor._ImmutableMapping'\u003e\n",
1359-
"WARNING:tensorflow:Mapping types may not work well with tf.nest. Prefer using MutableMapping for \u003cclass 'tensorflow_gnn.graph.graph_tensor._ImmutableMapping'\u003e\n"
1358+
"WARNING:tensorflow:Mapping types may not work well with tf.nest. Prefer using MutableMapping for <class 'tensorflow_gnn.graph.graph_tensor._ImmutableMapping'>\n",
1359+
"WARNING:tensorflow:Mapping types may not work well with tf.nest. Prefer using MutableMapping for <class 'tensorflow_gnn.graph.graph_tensor._ImmutableMapping'>\n"
13601360
]
13611361
}
13621362
],
@@ -1563,7 +1563,7 @@
15631563
"\n",
15641564
"Notice that the conventional names *source* and *target* for the endpoints of a directed edge do **not** prescribe the direction of information flow: each \"written\" edge logically goes from a paper to its author (so the \"author\" node is its `TARGET`), yet this model lets the data flow towards the paper (and the \"paper\" node is its `SOURCE`). In fact, sampled subgraphs have edges directed away from the root node, so data flow towards the root often goes from `TARGET` to `SOURCE`.\n",
15651565
"\n",
1566-
"\u003e Note on terminology: Convolutions are best known in deep learning for convolutional neural networks on image data, in which they aggregate information from a small, fixed, implicitly understood neighborhood of each element in a pixel grid. The term loosely carries over to graphs by interpreting edges as explicit, variable definitions of a node's neighborhood.\n",
1566+
"> Note on terminology: Convolutions are best known in deep learning for convolutional neural networks on image data, in which they aggregate information from a small, fixed, implicitly understood neighborhood of each element in a pixel grid. The term loosely carries over to graphs by interpreting edges as explicit, variable definitions of a node's neighborhood.\n",
15671567
"\n",
15681568
"The code above creates fresh Convolution and NextState layer objects for each edge set and node set, resp., and for each round of updates. This means they all have separate trainable weights. If desired, weight sharing is possible in the standard Keras way by sharing convolution and next-state layer objects, provided the input sizes match.\n",
15691569
"\n",

0 commit comments

Comments
 (0)