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

Function WriteTensor

tensorflow/core/util/tensor_bundle/tensor_bundle.cc:225–233  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

223// bytes written.
224// REQUIRES: val.dtype() != DT_STRING
225Status 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().

Callers 1

AddMethod · 0.85

Calls 4

GetBackingBufferFunction · 0.85
dtypeMethod · 0.45
TotalBytesMethod · 0.45
AppendMethod · 0.45

Tested by

no test coverage detected