def testInitWithVariableReuse(self):
    with self.cached_session():
        p = pruning.Pruning(spec=self.pruning_hparams, sparsity=self.sparsity)
        p_copy = pruning.Pruning(spec=self.pruning_hparams, sparsity=self.sparsity)
        variables.global_variables_initializer().run()
        sparsity = p._sparsity.eval()
        self.assertAlmostEqual(sparsity, 0.5)
        self.assertEqual(p._sparsity.eval(), p_copy._sparsity.eval())
def testInitWithVariableReuse(self):
    with self.cached_session():
        p = pruning.Pruning(spec=self.pruning_hparams, sparsity=self.sparsity)
        p_copy = pruning.Pruning(spec=self.pruning_hparams, sparsity=self.sparsity)
        variables.global_variables_initializer().run()
        sparsity = p._sparsity.eval()
        self.assertAlmostEqual(sparsity, 0.5)
        self.assertEqual(p._sparsity.eval(), p_copy._sparsity.eval())