(self)
| 288 | np.zeros((2))) |
| 289 | |
| 290 | def testEagerExecution(self): |
| 291 | with context.eager_mode(): |
| 292 | container = variable_scope.EagerVariableStore() |
| 293 | x = constant_op.constant([[2.0]]) |
| 294 | with container.as_default(): |
| 295 | y = core_layers.dense( |
| 296 | x, 1, name='my_dense', |
| 297 | kernel_initializer=init_ops.ones_initializer()) |
| 298 | self.assertAllEqual(y, [[2.0]]) |
| 299 | self.assertEqual(len(container.variables()), 2) |
| 300 | # Recreate the layer to test reuse. |
| 301 | with container.as_default(): |
| 302 | core_layers.dense( |
| 303 | x, 1, name='my_dense', |
| 304 | kernel_initializer=init_ops.ones_initializer()) |
| 305 | self.assertEqual(len(container.variables()), 2) |
| 306 | |
| 307 | def testFunctionalDenseWithCustomGetter(self): |
| 308 | called = [0] |
nothing calls this directly
no test coverage detected