MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / testActivityRegularizer

Method testActivityRegularizer

tensorflow/python/layers/core_test.py:185–193  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

183
184 @test_util.run_deprecated_v1
185 def testActivityRegularizer(self):
186 regularizer = lambda x: math_ops.reduce_sum(x) * 1e-3
187 dense = core_layers.Dense(
188 2, name='my_dense', activity_regularizer=regularizer)
189 inputs = random_ops.random_uniform((5, 3), seed=1)
190 _ = dense(inputs)
191 loss_keys = ops.get_collection(ops.GraphKeys.REGULARIZATION_LOSSES)
192 self.assertEqual(len(loss_keys), 1)
193 self.assertListEqual(dense.losses, loss_keys)
194
195 @test_util.run_deprecated_v1
196 def testKernelRegularizer(self):

Callers

nothing calls this directly

Calls 4

denseFunction · 0.85
reduce_sumMethod · 0.80
random_uniformMethod · 0.80
get_collectionMethod · 0.45

Tested by

no test coverage detected