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

Function TEST_F

tensorflow/core/framework/resource_op_kernel_test.cc:132–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130};
131
132TEST_F(ResourceOpKernelTest, PrivateResource) {
133 // Empty shared_name means private resource.
134 const int code = -100;
135 auto op = CreateOp(code, "");
136 ASSERT_TRUE(op != nullptr);
137 TF_EXPECT_OK(RunOpKernel(op.get()));
138
139 // Default non-shared name provided from ContainerInfo.
140 const string key = "_0_" + op->name();
141
142 StubResource* resource;
143 TF_ASSERT_OK(
144 mgr_.Lookup<StubResource>(mgr_.default_container(), key, &resource));
145 EXPECT_EQ(op->resource(), resource); // Check resource identity.
146 EXPECT_EQ(code, resource->code); // Check resource stored information.
147 resource->Unref();
148
149 // Destroy the op kernel. Expect the resource to be released.
150 op = nullptr;
151 Status s =
152 mgr_.Lookup<StubResource>(mgr_.default_container(), key, &resource);
153
154 EXPECT_FALSE(s.ok());
155}
156
157TEST_F(ResourceOpKernelTest, SharedResource) {
158 const string shared_name = "shared_stub";

Callers

nothing calls this directly

Calls 5

nameMethod · 0.65
getMethod · 0.45
resourceMethod · 0.45
UnrefMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected