We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3ff21f8 + 2944bc6 commit 102d56fCopy full SHA for 102d56f
keras/regularizers.py
@@ -368,7 +368,7 @@ def __call__(self, inputs):
368
size = inputs.shape[1]
369
product_no_diagonal = product * (1. - tf.eye(size, dtype=inputs.dtype))
370
num_pairs = size * (size - 1.) / 2.
371
- return self.factor * 0.5 * tf.reduce_sum(product_no_diagonal) / num_pairs
+ return self.factor * 0.5 * tf.reduce_sum(tf.abs(product_no_diagonal)) / num_pairs
372
373
def get_config(self):
374
return {'factor': float(self.factor), 'mode': self.mode}
0 commit comments