| 221 | } |
| 222 | |
| 223 | Status 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 | |
| 239 | REGISTER_KERNEL_BUILDER(Name("_FileSliceSend").Device(DEVICE_CPU), |
| 240 | FileSliceSendOp); |
nothing calls this directly
no test coverage detected