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

Function ReadBlobDim

source/core/ConvolutionCommon.cpp:25–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23}
24
25static int ReadBlobDim(BaseLoader* myfile, unsigned int* shape, int shapeBufCnt, bool useInt32) {
26 uint8_t uSize = 0;
27 myfile->read((char*)&uSize, 1);
28 if (uSize > 4) {
29 printf("Read shape error!\n");
30 return 0;
31 }
32 int copyLength = uSize;
33 if (copyLength > shapeBufCnt) {
34 copyLength = shapeBufCnt;
35 }
36 if (useInt32) {
37 myfile->read((char*)shape, sizeof(unsigned int) * copyLength);
38 } else {
39 uint16_t shape_i16[32] = {0};
40 myfile->read((char*)shape_i16, sizeof(uint16_t) * copyLength);
41 for (int i = 0; i < copyLength; ++i) {
42 shape[i] = shape_i16[i];
43 }
44 }
45 return copyLength;
46}
47
48static double _log2(double x) {
49 return log(x) / log(2);

Callers 3

ReadQuanInfoFunction · 0.85
ReadQuanData_cFunction · 0.85
ReadSparseQuanData_cFunction · 0.85

Calls 1

readMethod · 0.45

Tested by

no test coverage detected