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

Function ElementSize

tensorflow/lite/toco/tooling_util.cc:1742–1776  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1740}
1741
1742int ElementSize(ArrayDataType data_type) {
1743 switch (data_type) {
1744 case ArrayDataType::kBool:
1745 return sizeof(bool);
1746 case ArrayDataType::kFloat:
1747 return 4;
1748 case ArrayDataType::kInt8:
1749 return 1;
1750 case ArrayDataType::kUint8:
1751 return 1;
1752 case ArrayDataType::kInt16:
1753 return 2;
1754 case ArrayDataType::kUint16:
1755 return 2;
1756 case ArrayDataType::kInt32:
1757 return 4;
1758 case ArrayDataType::kUint32:
1759 return 4;
1760 case ArrayDataType::kInt64:
1761 return 8;
1762 case ArrayDataType::kUint64:
1763 return 8;
1764 case ArrayDataType::kComplex64:
1765 return 8;
1766
1767 // Usually not critical limitation because strings are only input and/or
1768 // output.
1769 case ArrayDataType::kString:
1770 LOG(FATAL) << "Transient arrays with strings are not supported yet";
1771 return 0;
1772 default:
1773 LOG(FATAL) << "Unknown data_type = " << static_cast<int>(data_type);
1774 return 0;
1775 }
1776}
1777
1778void DropMinMax(Model* model, const string& array_name) {
1779 auto& array = model->GetArray(array_name);

Callers 3

DedupeConstantArraysFunction · 0.85
TransientArraySizeFunction · 0.85
PackFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected