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

Function _Scale

express/NeuralNetWorkOp.cpp:416–425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

414 return (Variable::create(Expr::create(reshape.get(), {x, shape})));
415}
416VARP _Scale(VARP x, int channels, std::vector<float>&& scales, std::vector<float>&& bias) {
417 std::unique_ptr<OpT> scale(new OpT);
418 scale->type = OpType_Scale;
419 scale->main.type = OpParameter_Scale;
420 scale->main.value = new ScaleT;
421 scale->main.AsScale()->channels = channels;
422 scale->main.AsScale()->scaleData = std::move(scales);
423 scale->main.AsScale()->biasData = std::move(bias);
424 return (Variable::create(Expr::create(std::move(scale), {x})));
425}
426/*Given an input value x, it computes the output as x if x > 0 and slope * x if x <= 0.
427Args:
428x: A variable.

Callers 9

onExecuteMethod · 0.85
onForwardMethod · 0.85
onGradMethod · 0.85
onGradMethod · 0.85
onExecuteMethod · 0.85
runMethod · 0.85
runMethod · 0.85
runMethod · 0.85
PyMNNExpr_scaleFunction · 0.85

Calls 2

AsScaleMethod · 0.80
createFunction · 0.50

Tested by 3

runMethod · 0.68
runMethod · 0.68
runMethod · 0.68