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

Function TransferFile

tensorflow/core/kernels/file_slice_sendrecv_ops_test.cc:221–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219// Graph Constructor.
220
221static Graph* TransferFile(const std::string& test_type,
222 const int32 slice_size) {
223 Graph* g = new Graph(OpRegistry::Global());
224 const int64 timeout_ms = 5000;
225 std::string recv_dir = "/tmp/FileSliceTransferTestRecv";
226 std::string filename = "/tmp/FileSliceTransferTestSend/send_" + test_type;
227 std::string contents = \
228 "The quick brown fox jumps over the lazy dog."; // 44 chars.
229
230 // send filename node.
231 Tensor filename_t(DT_STRING, TensorShape({}));
232 filename_t.scalar<tstring>().setConstant(filename);
233 Node* filename_n = test::graph::Constant(g, filename_t);
234
235 // contents node.
236 Tensor contents_t(DT_STRING, TensorShape({}));
237 contents_t.scalar<tstring>().setConstant(contents);
238 Node* contents_n = test::graph::Constant(g, contents_t);
239
240 Node* write_file_n = WriteFile(g, filename_n, contents_n);
241 Node* send_n = \
242 FileSliceSend(g, filename_n, test_type, "/cpu:0", 1, "/cpu:0", slice_size);
243 g->AddControlEdge(write_file_n, send_n);
244
245 Node* recv_n = FileSliceRecv(g, test_type, "/cpu:0", 1, "/cpu:0", recv_dir,
246 slice_size, timeout_ms);
247 Node* read_file_n = ReadFile(g, recv_n);
248 Node* equal_n = Equal(g, contents_n, read_file_n);
249
250 std::vector<NodeBuilder::NodeOut> data_out;
251 data_out.emplace_back(contents_n, 0);
252 data_out.emplace_back(read_file_n, 0);
253 Assert(g, equal_n, data_out);
254
255 return g;
256}
257
258static Graph* FileSliceSendTransferFileToSliceRecv(const std::string& test_type,
259 const int32 slice_size) {

Callers 2

TransferSmallFileFunction · 0.85
TransferBigFileFunction · 0.85

Calls 10

FileSliceSendFunction · 0.85
FileSliceRecvFunction · 0.85
ConstantFunction · 0.70
WriteFileFunction · 0.70
ReadFileFunction · 0.70
EqualFunction · 0.70
AssertFunction · 0.70
TensorShapeClass · 0.50
AddControlEdgeMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected