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

Method onGrad

tools/train/source/grad/RoiPoolGrad.cpp:17–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15class RoiPoolGrad : public OpGrad {
16public:
17 virtual std::vector<Express::VARP> onGrad(Express::EXPRP expr, const std::vector<Express::VARP>& backwardOutput) override {
18 std::vector<Express::VARP> res(1, nullptr);
19 auto input = expr->inputs()[0];
20 auto roi = expr->inputs()[1];
21
22 std::unique_ptr<OpT> forwardOp(expr->get()->UnPack());
23 auto param = forwardOp->main.AsRoiParameters();
24 int pooledHeight = param->pooledHeight;
25 int pooledWidth = param->pooledWidth;
26 auto spatialScale = param->spatialScale;
27
28 res[0] = _ROIPooling(input, roi, pooledHeight, pooledWidth, spatialScale, true, _Convert(backwardOutput[0], NC4HW4));
29 res[0] = _Convert(res[0], input->getInfo()->order);
30
31 return res;
32 }
33};
34
35static void _create() {

Callers

nothing calls this directly

Calls 6

_ROIPoolingFunction · 0.85
_ConvertFunction · 0.85
AsRoiParametersMethod · 0.80
UnPackMethod · 0.45
getMethod · 0.45
getInfoMethod · 0.45

Tested by

no test coverage detected