From ed3c18518a964b74434767518823d3afc8eab097 Mon Sep 17 00:00:00 2001 From: Naren Dasan Date: Thu, 19 Nov 2020 12:53:56 -0800 Subject: [PATCH] fix(aten::max_pool2d): Supressing error due to not filling in stride in the default case Signed-off-by: Naren Dasan Signed-off-by: Naren Dasan --- core/conversion/converters/impl/pooling.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/conversion/converters/impl/pooling.cpp b/core/conversion/converters/impl/pooling.cpp index c64cb7dbf4..02ded095c2 100644 --- a/core/conversion/converters/impl/pooling.cpp +++ b/core/conversion/converters/impl/pooling.cpp @@ -30,6 +30,10 @@ bool MaxPoolingConverter(ConversionCtx* ctx, const torch::jit::Node* n, args& ar auto padding = util::toDims(args[3].unwrapToIntList()); LOG_DEBUG("padding: " << padding); auto stride = util::toDims(args[2].unwrapToIntList()); + if (args[2].unwrapToIntList().size() == 0) { + LOG_DEBUG("Stride not providied, using kernel_size as stride"); + stride = util::toDims(args[1].unwrapToIntList()); + } LOG_DEBUG("stride: " << stride); auto dilation = util::toDims(args[4].unwrapToIntList()); @@ -88,6 +92,10 @@ bool AvgPoolingConverter(ConversionCtx* ctx, const torch::jit::Node* n, args& ar auto padding = util::toDims(args[3].unwrapToIntList()); LOG_DEBUG("padding: " << padding); auto stride = util::toDims(args[2].unwrapToIntList()); + if (args[2].unwrapToIntList().size() == 0) { + LOG_DEBUG("Stride not providied, using kernel_size as stride"); + stride = util::toDims(args[1].unwrapToIntList()); + } LOG_DEBUG("stride: " << stride); bool ceil_mode = args[4].unwrapToBool();