Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/vision/gradient_centralization.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def prepare(ds, shuffle=False, augment=False):
subclass the `RMSProp` optimizer class modifying the
`keras.optimizers.Optimizer.get_gradients()` method where we now implement Gradient
Centralization. On a high level the idea is that let us say we obtain our gradients
through back propogation for a Dense or Convolution layer we then compute the mean of the
through back propagation for a Dense or Convolution layer we then compute the mean of the
column vectors of the weight matrix, and then remove the mean from each column vector.

The experiments in [this paper](https://arxiv.org/abs/2004.01461) on various
Expand Down
13 changes: 5 additions & 8 deletions examples/vision/ipynb/gradient_centralization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@
"from keras import ops\n",
"\n",
"from tensorflow import data as tf_data\n",
"import tensorflow_datasets as tfds\n",
""
"import tensorflow_datasets as tfds\n"
]
},
{
Expand Down Expand Up @@ -159,8 +158,7 @@
" )\n",
"\n",
" # Use buffered prefecting\n",
" return ds.prefetch(buffer_size=AUTOTUNE)\n",
""
" return ds.prefetch(buffer_size=AUTOTUNE)\n"
]
},
{
Expand Down Expand Up @@ -238,7 +236,7 @@
"subclass the `RMSProp` optimizer class modifying the\n",
"`keras.optimizers.Optimizer.get_gradients()` method where we now implement Gradient\n",
"Centralization. On a high level the idea is that let us say we obtain our gradients\n",
"through back propogation for a Dense or Convolution layer we then compute the mean of the\n",
"through back propagation for a Dense or Convolution layer we then compute the mean of the\n",
"column vectors of the weight matrix, and then remove the mean from each column vector.\n",
"\n",
"The experiments in [this paper](https://arxiv.org/abs/2004.01461) on various\n",
Expand Down Expand Up @@ -314,8 +312,7 @@
" self.epoch_time_start = time()\n",
"\n",
" def on_epoch_end(self, batch, logs={}):\n",
" self.times.append(time() - self.epoch_time_start)\n",
""
" self.times.append(time() - self.epoch_time_start)\n"
]
},
{
Expand Down Expand Up @@ -473,4 +470,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
2 changes: 1 addition & 1 deletion examples/vision/md/gradient_centralization.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ We will now
subclass the `RMSProp` optimizer class modifying the
`keras.optimizers.Optimizer.get_gradients()` method where we now implement Gradient
Centralization. On a high level the idea is that let us say we obtain our gradients
through back propogation for a Dense or Convolution layer we then compute the mean of the
through back propagation for a Dense or Convolution layer we then compute the mean of the
column vectors of the weight matrix, and then remove the mean from each column vector.

The experiments in [this paper](https://arxiv.org/abs/2004.01461) on various
Expand Down