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

Method ReadFileSlice

tensorflow/core/kernels/file_slice_sendrecv_ops.cc:223–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221}
222
223Status FileSliceSendOp::ReadFileSlice(
224 const std::unique_ptr<RandomAccessFile>& file,
225 const uint64 pos, const uint64 offset,
226 Tensor& data_t) {
227 string* data_s = data_t.scalar<tstring>().data();
228 gtl::STLStringResizeUninitialized(data_s, offset);
229 char* data_p = gtl::string_as_array(data_s);
230 StringPiece result;
231 TF_RETURN_IF_ERROR(file->Read(pos, offset, &result, data_p));
232 if (result.data() != data_p) {
233 memmove(data_p, result.data(), result.size());
234 }
235
236 return Status::OK();
237}
238
239REGISTER_KERNEL_BUILDER(Name("_FileSliceSend").Device(DEVICE_CPU),
240 FileSliceSendOp);

Callers

nothing calls this directly

Calls 5

string_as_arrayFunction · 0.85
dataMethod · 0.45
ReadMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected