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

Method SaveData

tensorflow/core/util/tensor_slice_writer.cc:179–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177
178template <>
179Status TensorSliceWriter::SaveData(const tstring* data, int64 num_elements,
180 SavedSlice* ss) {
181 size_t size_bound = ss->ByteSize() + kTensorProtoHeaderBytes +
182 (num_elements * MaxBytesPerElement(DT_INT32));
183 for (int64 i = 0; i < num_elements; ++i) {
184 size_bound += data[i].size();
185 }
186 if (size_bound > kMaxMessageBytes) {
187 return errors::InvalidArgument(
188 "Tensor slice is too large to serialize (conservative estimate: ",
189 size_bound, " bytes)");
190 }
191 Fill(data, num_elements, ss->mutable_data());
192 DCHECK_GE(ss->ByteSize(), 0);
193 DCHECK_LE(ss->ByteSize(), size_bound);
194 return Status::OK();
195}
196
197} // namespace checkpoint
198

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected