Skip to content

Commit 102d56f

Browse files
authored
Merge pull request #1 from Kiwiakos/Kiwiakos-patch-1
Fix OrthogonalRegularizer to implement the (1,1) matrix norm
2 parents 3ff21f8 + 2944bc6 commit 102d56f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

keras/regularizers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def __call__(self, inputs):
368368
size = inputs.shape[1]
369369
product_no_diagonal = product * (1. - tf.eye(size, dtype=inputs.dtype))
370370
num_pairs = size * (size - 1.) / 2.
371-
return self.factor * 0.5 * tf.reduce_sum(product_no_diagonal) / num_pairs
371+
return self.factor * 0.5 * tf.reduce_sum(tf.abs(product_no_diagonal)) / num_pairs
372372

373373
def get_config(self):
374374
return {'factor': float(self.factor), 'mode': self.mode}

0 commit comments

Comments
 (0)