Serializes the data bytes of the non-string tensor "val". Discards the original content of "bytes_written", and on OK updates it with number of bytes written. REQUIRES: val.dtype() != DT_STRING
| 223 | // bytes written. |
| 224 | // REQUIRES: val.dtype() != DT_STRING |
| 225 | Status WriteTensor(const Tensor& val, FileOutputBuffer* out, |
| 226 | size_t* bytes_written) { |
| 227 | DCHECK_NE(val.dtype(), DT_STRING); |
| 228 | DCHECK_NE(val.dtype(), DT_VARIANT); |
| 229 | *bytes_written = val.TotalBytes(); |
| 230 | char* buf = GetBackingBuffer(val); |
| 231 | VLOG(1) << "Appending " << *bytes_written << " bytes to file"; |
| 232 | return out->Append(StringPiece(buf, *bytes_written)); |
| 233 | } |
| 234 | |
| 235 | // Serializes string tensor "val". "bytes_written" is treated in the same |
| 236 | // fashion as WriteTensor(). |
no test coverage detected