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

Function formatInput

tools/cv/source/imgproc/filter.cpp:23–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21}
22
23static halide_type_t formatInput(VARP& src, bool fp = true) {
24 auto info = src->getInfo();
25 auto dim = info->dim;
26 int height, width, channel;
27 getVARPSize(src, &height, &width, &channel);
28 if (dim.size() != 4) {
29 if (src->getInfo()->order == NHWC) {
30 src = _Reshape(src, {1, height, width, channel});
31 } else {
32 src = _Convert(_Reshape(src, {1, channel, height, width}), NHWC);
33 }
34 }
35 if (fp && src->getInfo() && src->getInfo()->type.code != halide_type_float) {
36 src = _Cast(src, halide_type_of<float>());
37 }
38 return info->type;
39}
40
41static VARP formatOutput(VARP src, halide_type_t type) {
42 auto dim = src->getInfo()->dim;

Callers 7

pyrFunction · 0.85
dilateFunction · 0.85
erodeFunction · 0.85
filter2DFunction · 0.85
pyrDownFunction · 0.85
pyrUpFunction · 0.85
sepFilter2DFunction · 0.85

Calls 6

_ReshapeFunction · 0.85
_ConvertFunction · 0.85
getVARPSizeFunction · 0.50
_CastFunction · 0.50
getInfoMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected