How To Scale The Gradient During Batch Update In Keras?
I am using a standard keras model and I am training on batch (using the train_on_batch function). Now, I want to take the gradient of each element in the batch and scale it (multip
Solution 1:
- Use the
sample_weightsargument in thefitmethod of a model. - Or, if using a generator, make the generator return not only
X_train, y_train, butX_train, y_train, sample_weights.
In both cases, sample_weights should be a 1D vector with the same number of samples as the data.
Post a Comment for "How To Scale The Gradient During Batch Update In Keras?"