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

Method testNonTrainable

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

Source from the content-addressed store, hash-verified

115
116 @test_util.run_in_graph_and_eager_modes
117 def testNonTrainable(self):
118 dense = core_layers.Dense(2, trainable=False, name='my_dense')
119 inputs = random_ops.random_uniform((5, 2), seed=1)
120 _ = dense(inputs)
121 self.assertListEqual(dense.variables, [dense.kernel, dense.bias])
122 self.assertListEqual(dense.non_trainable_variables,
123 [dense.kernel, dense.bias])
124 self.assertListEqual(dense.trainable_variables, [])
125 if not context.executing_eagerly():
126 self.assertEqual(
127 len(ops.get_collection(ops.GraphKeys.TRAINABLE_VARIABLES)), 0)
128
129 @test_util.run_in_graph_and_eager_modes
130 def testOutputShape(self):

Callers

nothing calls this directly

Calls 4

denseFunction · 0.85
random_uniformMethod · 0.80
executing_eagerlyMethod · 0.80
get_collectionMethod · 0.45

Tested by

no test coverage detected