(self)
| 258 | self._testCheckpointCrossDevice(False, False, True, False) |
| 259 | |
| 260 | def testCreateBN(self): |
| 261 | # Call layer. |
| 262 | bn = normalization_layers.BatchNormalization(axis=1) |
| 263 | inputs = random_ops.random_uniform((5, 4, 3), seed=1) |
| 264 | training = array_ops.placeholder(dtype='bool') |
| 265 | outputs = bn.apply(inputs, training=training) |
| 266 | |
| 267 | # Verify shape. |
| 268 | self.assertListEqual(outputs.get_shape().as_list(), [5, 4, 3]) |
| 269 | |
| 270 | # Verify layer attributes. |
| 271 | self.assertEqual(len(bn.updates), 2) |
| 272 | self.assertEqual(len(bn.variables), 4) |
| 273 | self.assertEqual(len(bn.trainable_variables), 2) |
| 274 | self.assertEqual(len(bn.non_trainable_variables), 2) |
| 275 | |
| 276 | # Test that updates were created and added to UPDATE_OPS. |
| 277 | self.assertEqual(len(bn.updates), 2) |
| 278 | self.assertListEqual( |
| 279 | ops.get_collection(ops.GraphKeys.UPDATE_OPS), bn.updates) |
| 280 | |
| 281 | # Test that weights were created and added to TRAINABLE_VARIABLES. |
| 282 | self.assertListEqual( |
| 283 | ops.get_collection(ops.GraphKeys.TRAINABLE_VARIABLES), |
| 284 | bn.trainable_variables) |
| 285 | |
| 286 | def testCreateFusedBNFloat16(self): |
| 287 | # Call layer. |
nothing calls this directly
no test coverage detected