Skip to content

Commit 489038c

Browse files
Fixes monospace formatting for layer subclassing docs (#2060)
1 parent fd86dc9 commit 489038c

3 files changed

+10
-16
lines changed

guides/ipynb/making_new_layers_and_models_via_subclassing.ipynb

+8-14
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@
9797
" self.b = self.add_weight(shape=(units,), initializer=\"zeros\", trainable=True)\n",
9898
"\n",
9999
" def call(self, inputs):\n",
100-
" return ops.matmul(inputs, self.w) + self.b\n",
101-
""
100+
" return ops.matmul(inputs, self.w) + self.b\n"
102101
]
103102
},
104103
{
@@ -246,8 +245,7 @@
246245
" self.b = self.add_weight(shape=(units,), initializer=\"zeros\", trainable=True)\n",
247246
"\n",
248247
" def call(self, inputs):\n",
249-
" return ops.matmul(inputs, self.w) + self.b\n",
250-
""
248+
" return ops.matmul(inputs, self.w) + self.b\n"
251249
]
252250
},
253251
{
@@ -289,8 +287,7 @@
289287
" )\n",
290288
"\n",
291289
" def call(self, inputs):\n",
292-
" return ops.matmul(inputs, self.w) + self.b\n",
293-
""
290+
" return ops.matmul(inputs, self.w) + self.b\n"
294291
]
295292
},
296293
{
@@ -390,7 +387,7 @@
390387
"The `keras.ops` namespace gives you access to:\n",
391388
"\n",
392389
"- The NumPy API, e.g. `ops.matmul`, `ops.sum`, `ops.reshape`, `ops.stack`, etc.\n",
393-
"- Neural networks-specific APIs such as `ops.softmax`, `ops`.conv`, `ops.binary_crossentropy`, `ops.relu`, etc.\n",
390+
"- Neural networks-specific APIs such as `ops.softmax`, `ops.conv`, `ops.binary_crossentropy`, `ops.relu`, etc.\n",
394391
"\n",
395392
"You can also use backend-native APIs in your layers (such as `tf.nn` functions),\n",
396393
"but if you do this, then your layer will only be usable with the backend in question.\n",
@@ -465,8 +462,7 @@
465462
"\n",
466463
" def call(self, inputs):\n",
467464
" self.add_loss(self.rate * ops.mean(inputs))\n",
468-
" return inputs\n",
469-
""
465+
" return inputs\n"
470466
]
471467
},
472468
{
@@ -742,8 +738,7 @@
742738
" return keras.random.dropout(\n",
743739
" inputs, rate=self.rate, seed=self.seed_generator\n",
744740
" )\n",
745-
" return inputs\n",
746-
""
741+
" return inputs\n"
747742
]
748743
},
749744
{
@@ -947,8 +942,7 @@
947942
" z_log_var - ops.square(z_mean) - ops.exp(z_log_var) + 1\n",
948943
" )\n",
949944
" self.add_loss(kl_loss)\n",
950-
" return reconstructed\n",
951-
""
945+
" return reconstructed\n"
952946
]
953947
},
954948
{
@@ -1010,4 +1004,4 @@
10101004
},
10111005
"nbformat": 4,
10121006
"nbformat_minor": 0
1013-
}
1007+
}

guides/making_new_layers_and_models_via_subclassing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def call(self, inputs):
227227
The `keras.ops` namespace gives you access to:
228228
229229
- The NumPy API, e.g. `ops.matmul`, `ops.sum`, `ops.reshape`, `ops.stack`, etc.
230-
- Neural networks-specific APIs such as `ops.softmax`, `ops`.conv`, `ops.binary_crossentropy`, `ops.relu`, etc.
230+
- Neural networks-specific APIs such as `ops.softmax`, `ops.conv`, `ops.binary_crossentropy`, `ops.relu`, etc.
231231
232232
You can also use backend-native APIs in your layers (such as `tf.nn` functions),
233233
but if you do this, then your layer will only be usable with the backend in question.

guides/md/making_new_layers_and_models_via_subclassing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ All layers you've seen so far in this guide work with all Keras backends.
272272
The `keras.ops` namespace gives you access to:
273273

274274
- The NumPy API, e.g. `ops.matmul`, `ops.sum`, `ops.reshape`, `ops.stack`, etc.
275-
- Neural networks-specific APIs such as `ops.softmax`, `ops`.conv`, `ops.binary_crossentropy`, `ops.relu`, etc.
275+
- Neural networks-specific APIs such as `ops.softmax`, `ops.conv`, `ops.binary_crossentropy`, `ops.relu`, etc.
276276

277277
You can also use backend-native APIs in your layers (such as `tf.nn` functions),
278278
but if you do this, then your layer will only be usable with the backend in question.

0 commit comments

Comments
 (0)