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

Function AvailableArrayName

tensorflow/lite/toco/tooling_util.cc:1815–1834  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1813}
1814
1815string AvailableArrayName(const Model& model, const string& name) {
1816 string sanitized_name = SanitizeNameForTFNode(name);
1817 if (!model.HasArray(sanitized_name) &&
1818 !model.IsOptionalArray(sanitized_name)) {
1819 return sanitized_name;
1820 }
1821 const int kNumSuffixesToTry = 1000;
1822 for (int i = 0; i < kNumSuffixesToTry; i++) {
1823 const string& name_with_suffix =
1824 toco::port::StringF("%s_%d", sanitized_name, i);
1825 if (!model.HasArray(name_with_suffix) &&
1826 !model.IsOptionalArray(name_with_suffix)) {
1827 return name_with_suffix;
1828 }
1829 }
1830 LOG(FATAL) << "Could not find an available array name starting with "
1831 << sanitized_name << ". Tried " << kNumSuffixesToTry
1832 << " suffixes, all were taken!";
1833 return "";
1834}
1835
1836string ShapeToString(const Shape& shape) {
1837 if (shape.dimensions_count() == 0) {

Callers 15

FixEdgeArraysFunction · 0.85
InsertCopyOperatorFunction · 0.85
CreateInt32ArrayFunction · 0.85
CreateConstArrayFunction · 0.85
ConvertConvOperatorFunction · 0.85
ConvertGatherOperatorFunction · 0.85
ProcessConvOperatorFunction · 0.85
RunMethod · 0.85

Calls 4

SanitizeNameForTFNodeFunction · 0.85
StringFFunction · 0.85
HasArrayMethod · 0.80
IsOptionalArrayMethod · 0.80

Tested by

no test coverage detected