Skip to content

Commit 2414199

Browse files
Regenerated.md and .ipynb with the latest changes of .py
1 parent 2f00172 commit 2414199

File tree

3 files changed

+59
-57
lines changed

3 files changed

+59
-57
lines changed

examples/vision/focal_modulation_network.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
import os
7979

8080
# Set backend before importing keras
81-
os.environ["KERAS_BACKEND"] = "jax" # Or "torch" or "tensorflow"
81+
os.environ["KERAS_BACKEND"] = "tensorflow" # Or "torch" or "tensorflow"
8282

8383
import numpy as np
8484
import keras

examples/vision/ipynb/focal_modulation_network.ipynb

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,12 @@
102102
"import os\n",
103103
"\n",
104104
"# Set backend before importing keras\n",
105-
"os.environ[\"KERAS_BACKEND\"] = \"jax\" # Or \"torch\" or \"tensorflow\"\n",
105+
"os.environ[\"KERAS_BACKEND\"] = \"tensorflow\" # Or \"torch\" or \"tensorflow\"\n",
106106
"\n",
107107
"import numpy as np\n",
108108
"import keras\n",
109109
"from keras import layers\n",
110110
"from keras import ops\n",
111-
"from typing import Optional\n",
112111
"from matplotlib import pyplot as plt\n",
113112
"from random import randint\n",
114113
"\n",
@@ -155,6 +154,7 @@
155154
},
156155
"source": [
157156
"## Data Loading with PyDataset\n",
157+
"\n",
158158
"Keras 3 introduces PyDataset as a standardized way to handle data.\n",
159159
"It works identically across all backends and avoids the \"Symbolic Tensor\" issues often found\n",
160160
"when using tf.data with JAX or PyTorch."
@@ -363,12 +363,7 @@
363363
"outputs": [],
364364
"source": [
365365
"\n",
366-
"def MLP(\n",
367-
" in_features: int,\n",
368-
" hidden_features: Optional[int] = None,\n",
369-
" out_features: Optional[int] = None,\n",
370-
" mlp_drop_rate: float = 0.0,\n",
371-
"):\n",
366+
"def MLP(in_features, hidden_features=None, out_features=None, mlp_drop_rate=0.0):\n",
372367
" hidden_features = hidden_features or in_features\n",
373368
" out_features = out_features or in_features\n",
374369
" return keras.Sequential(\n",
@@ -468,7 +463,7 @@
468463
"| Equation 5: Linear projection of `Z^0` (Source: Aritra and Ritwik) |\n",
469464
"\n",
470465
"`Z^0` is then passed on to a series of Depth-Wise (DWConv) Conv and\n",
471-
"[GeLU](hhttps://keras.io/api/layers/activations/#gelu-function) layers. The\n",
466+
"[GeLU](https://keras.io/api/layers/activations/#gelu-function) layers. The\n",
472467
"authors term each block of DWConv and GeLU as levels denoted by `l`. In **Figure 6** we\n",
473468
"have two levels. Mathematically this is represented as:\n",
474469
"\n",

0 commit comments

Comments
 (0)