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

Method testBiasRegularizer

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

Source from the content-addressed store, hash-verified

219
220 @test_util.run_deprecated_v1
221 def testBiasRegularizer(self):
222 regularizer = lambda x: math_ops.reduce_sum(x) * 1e-3
223 dense = core_layers.Dense(2, name='my_dense', bias_regularizer=regularizer)
224 inputs = random_ops.random_uniform((5, 3), seed=1)
225 _ = dense(inputs)
226 loss_keys = ops.get_collection(ops.GraphKeys.REGULARIZATION_LOSSES)
227 self.assertEqual(len(loss_keys), 1)
228 self.evaluate([v.initializer for v in dense.variables])
229 self.assertAllEqual(self.evaluate(dense.losses), self.evaluate(loss_keys))
230
231 @test_util.run_deprecated_v1
232 def testFunctionalDense(self):

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected