def testConcatSlice(self): r1 = test_ops.stub_resource_handle_op(container="a", shared_name="b") r2 = test_ops.stub_resource_handle_op(container="a", shared_name="c") c = array_ops.stack([r1, r2]) s = array_ops.strided_slice(c, [1], [2]) self.evaluate(test_ops.resource_create_op(s)) with self.assertRaises(errors.AlreadyExistsError): self.evaluate(test_ops.resource_create_op(r2))
def testConcatSlice(self): r1 = test_ops.stub_resource_handle_op(container="a", shared_name="b") r2 = test_ops.stub_resource_handle_op(container="a", shared_name="c") c = array_ops.stack([r1, r2]) s = array_ops.strided_slice(c, [1], [2]) self.evaluate(test_ops.resource_create_op(s)) with self.assertRaises(errors.AlreadyExistsError): self.evaluate(test_ops.resource_create_op(r2))
def test_run_feeds_iter_calls_resources_init(self): with tf.Graph().as_default() as g: in0, _, _ = self._build_inference_graph() handle = test_ops.stub_resource_handle_op(container='a', shared_name='b') resources.register_resource( handle=handle, create_op=test_ops.resource_create_op(handle), is_initialized_op=test_ops.resource_initialized_op(handle)) for _ in learn.graph_actions.run_feeds_iter({'in0': in0}, feed_dicts=[{}]): self.assertTrue(test_ops.resource_initialized_op(handle).eval())
def test_run_feeds_iter_calls_resources_init(self): with tf.Graph().as_default() as g: in0, _, _ = self._build_inference_graph() handle = test_ops.stub_resource_handle_op(container='a', shared_name='b') resources.register_resource( handle=handle, create_op=test_ops.resource_create_op(handle), is_initialized_op=test_ops.resource_initialized_op(handle)) for _ in learn.graph_actions.run_feeds_iter({'in0': in0}, feed_dicts=[{}]): self.assertTrue(test_ops.resource_initialized_op(handle).eval())