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

Method SaveData

tensorflow/core/util/tensor_slice_writer.h:164–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162
163template <typename T>
164Status TensorSliceWriter::SaveData(const T* data, int64 num_elements,
165 SavedSlice* ss) {
166 size_t size_bound =
167 ss->ByteSize() + kTensorProtoHeaderBytes +
168 (MaxBytesPerElement(DataTypeToEnum<T>::value) * num_elements);
169 if (size_bound > kMaxMessageBytes) {
170 return errors::InvalidArgument(
171 "Tensor slice is too large to serialize (conservative estimate: ",
172 size_bound, " bytes)");
173 }
174 Fill(data, num_elements, ss->mutable_data());
175 DCHECK_GE(ss->ByteSize(), 0);
176 DCHECK_LE(ss->ByteSize(), size_bound);
177 return Status::OK();
178}
179
180template <>
181Status TensorSliceWriter::SaveData(const tstring* data, int64 num_elements,

Callers

nothing calls this directly

Calls 4

InvalidArgumentFunction · 0.85
ByteSizeMethod · 0.80
mutable_dataMethod · 0.80
FillFunction · 0.70

Tested by

no test coverage detected