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

Function TEST

tensorflow/core/distributed_runtime/rpc/grpc_session_test.cc:87–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87TEST(GrpcSessionTest, BasicNonProtoAPI) {
88 GraphDef graph;
89 string node_names[3];
90 // c = a * b
91 CreateGraphDef(&graph, node_names);
92
93 std::unique_ptr<test::TestCluster> cluster;
94 TF_CHECK_OK(test::TestCluster::MakeTestCluster(Devices(1, 0), 2, &cluster));
95
96 std::unique_ptr<Session> session(
97 NewRemote(Options(cluster->targets()[0], 1)));
98 ASSERT_TRUE(session != nullptr);
99
100 for (int iters = 0; iters < 25; ++iters) {
101 TF_CHECK_OK(session->Create(graph));
102 {
103 // Just run to target node
104 std::vector<std::pair<string, Tensor>> inputs;
105 std::vector<string> targets = {node_names[2]};
106 TF_CHECK_OK(session->Run(inputs, {}, targets, nullptr));
107 }
108 {
109 // Run to a target node and a real tensor
110 std::vector<std::pair<string, Tensor>> inputs;
111 std::vector<string> names = {node_names[2] + ":0"};
112 std::vector<string> targets = {node_names[1]};
113 std::vector<Tensor> outputs;
114 TF_CHECK_OK(session->Run(inputs, names, targets, &outputs));
115 ASSERT_TRUE(outputs[0].IsInitialized());
116 ASSERT_EQ(4.0, outputs[0].flat<float>()(0));
117 }
118
119 TF_CHECK_OK(session->Close());
120 }
121}
122
123TEST(GrpcSessionTest, BasicCallable) {
124 GraphDef graph;

Callers

nothing calls this directly

Calls 15

SetDefaultDeviceFunction · 0.85
FindMaxEigenFunction · 0.85
DelayFunction · 0.85
DefaultFunction · 0.85
CreateInvalidGraphFunction · 0.85
targetsMethod · 0.80
add_targetMethod · 0.80
CreateGraphDefFunction · 0.70
DevicesFunction · 0.70
NewRemoteFunction · 0.70
OptionsFunction · 0.70
SetDeviceFunction · 0.70

Tested by

no test coverage detected