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

Function _Convert

express/NeuralNetWorkOp.cpp:531–544  ·  view source on GitHub ↗

Convert a variable to another format(possibily added after `input`). Args: input: A variable. format: The target format. Returns: A variable. If `input` is already `format`, then return `input` directly, otherwize add a variable after `input` with `format`. */

Source from the content-addressed store, hash-verified

529A variable. If `input` is already `format`, then return `input` directly, otherwize add a variable after `input` with `format`.
530*/
531VARP _Convert(VARP input, Dimensionformat format) {
532 if (nullptr != input->getInfo()) {
533 auto source = input->getInfo()->order;
534 if (source == format) {
535 return input;
536 }
537 }
538 std::unique_ptr<OpT> convert(new OpT);
539 convert->type = OpType_ConvertTensor;
540 convert->main.type = OpParameter_TensorConvertInfo;
541 convert->main.value = new TensorConvertInfoT;
542 convert->main.AsTensorConvertInfo()->dest = (MNN_DATA_FORMAT)Utils::convertFormat(format);
543 return (Variable::create(Expr::create(convert.get(), {input})));
544}
545/*Splits a variable value into a list of sub variables.
546Args:
547value: The variable to split.

Callers 15

formatInputFunction · 0.85
pyrDownFunction · 0.85
pyrUpFunction · 0.85
remapFunction · 0.85
getModuleInputsFunction · 0.85
mainFunction · 0.85
initGetThresholdFunction · 0.85
initGetMaxValueFunction · 0.85
compareOutputFunction · 0.85
mainFunction · 0.85
conformer_fbankFunction · 0.85
whisper_fbankFunction · 0.85

Calls 5

convertFormatFunction · 0.85
AsTensorConvertInfoMethod · 0.80
createFunction · 0.50
getInfoMethod · 0.45
getMethod · 0.45

Tested by 15

compareOutputFunction · 0.68
mainFunction · 0.68
runMethod · 0.68
runMethod · 0.68
runMethod · 0.68
runMethod · 0.68
_mobileNetV1ExprFunction · 0.68
_runMethod · 0.68
runMethod · 0.68
runMethod · 0.68
_runMethod · 0.68
runMethod · 0.68