| 1479 | } |
| 1480 | |
| 1481 | VARP _Interp(VARPS xs, float widthScale, float heightScale, int outputWidth, int outputHeight, int resizeType, bool alignCorners) { |
| 1482 | std::unique_ptr<OpT> interp(new OpT); |
| 1483 | interp->type = OpType_Interp; |
| 1484 | auto param = new InterpT; |
| 1485 | param->widthScale = widthScale; |
| 1486 | param->heightScale = heightScale; |
| 1487 | param->outputWidth = outputWidth; |
| 1488 | param->outputHeight = outputHeight; |
| 1489 | param->resizeType = resizeType; |
| 1490 | param->alignCorners = alignCorners; |
| 1491 | if ((resizeType == 2 || resizeType == 3) && alignCorners) { |
| 1492 | param->ctm = MNN::CoordinateTransformationMode_AlignCorners; |
| 1493 | } |
| 1494 | if ((resizeType == 2 || resizeType == 3) && !alignCorners) { |
| 1495 | param->ctm = MNN::CoordinateTransformationMode_PytorchHalfPixels; |
| 1496 | } |
| 1497 | interp->main.value = param; |
| 1498 | interp->main.type = OpParameter_Interp; |
| 1499 | return Variable::create(Expr::create(std::move(interp), xs)); |
| 1500 | } |
| 1501 | VARP _ZeroGrad(VARP x) { |
| 1502 | std::unique_ptr<OpT> op(new OpT); |
| 1503 | op->type = OpType_ZeroGrad; |