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

Function WriteRestVariables

tensorflow/c/quantize_embedding_variable.cc:27–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25namespace checkpoint {
26
27void WriteRestVariables(BundleReader& reader, BundleWriter& writer,
28 const std::vector<string>& ignored_names) {
29 std::set<string> excluded_names(ignored_names.cbegin(), ignored_names.cend());
30 std::vector<std::string> tensor_names;
31 reader.Seek(kHeaderEntryKey);
32 reader.Next();
33 for (; reader.Valid(); reader.Next()) {
34 tensor_names.emplace_back(reader.key());
35 }
36 for (auto& tensor_name : tensor_names) {
37 Status status;
38 DataType dtype;
39 TensorShape shape;
40 if (excluded_names.count(tensor_name)) continue;
41 status = reader.LookupDtypeAndShape(tensor_name, &dtype, &shape);
42 if (status.ok()) {
43 Tensor tensor(dtype, shape);
44 status = reader.Lookup(tensor_name, &tensor);
45 writer.Add(tensor_name, tensor);
46 }
47 }
48}
49
50void WriteRestVariables(BundleReader& reader, BundleWriter& writer,
51 const std::vector<string>& ignored_names,

Callers 2

RemoveVariableFunction · 0.85

Calls 12

LookupDtypeAndShapeMethod · 0.80
SeekMethod · 0.45
NextMethod · 0.45
ValidMethod · 0.45
emplace_backMethod · 0.45
keyMethod · 0.45
countMethod · 0.45
okMethod · 0.45
LookupMethod · 0.45
AddMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected