MCPcopy Create free account
hub / github.com/alibaba/MNN / shouldUseSparseConvolution

Function shouldUseSparseConvolution

tools/converter/source/common/AddSparseInfo.cpp:21–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19 return {1.f, 0.6f, 0.5f, 0.4f, 0.3f, 0.3f, 0.3f, 0.3f, 0.3f, 0.3f, 0.3f, 0.3f, 0.3f, 0.3f, 0.3f, 0.3f, 0.3f};
20}
21static bool inline shouldUseSparseConvolution(float sparsity, int sparseBlockOC) {
22 std::vector<float> thresholds = getSparsityThreshold();
23 return sparsity > thresholds[std::min(std::max(sparseBlockOC, 0), (int)thresholds.size() - 1)];
24}
25void AddSparseInfo(std::unique_ptr<MNN::OpT>& op, Compression::Pipeline proto) {
26 auto prune_algo_type = MNN::SparseAlgo_RANDOM;
27 int sparseBlockOC = 1;

Callers 1

AddSparseInfoFunction · 0.85

Calls 4

getSparsityThresholdFunction · 0.85
minFunction · 0.50
maxFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected