diff --git a/lib/Conversion/TorchToLinalg/Pooling.cpp b/lib/Conversion/TorchToLinalg/Pooling.cpp index 85354aad4f12..14d2c71dbc92 100644 --- a/lib/Conversion/TorchToLinalg/Pooling.cpp +++ b/lib/Conversion/TorchToLinalg/Pooling.cpp @@ -72,7 +72,8 @@ checkAndGetPoolingParameters(OpTy op, ConversionPatternRewriter &rewriter, return success(); } -static Value computeOutputTensor(Operation *op, ConversionPatternRewriter &rewriter, +static Value +computeOutputTensor(Operation *op, ConversionPatternRewriter &rewriter, Value self, int64_t dimensionality, bool ceilMode, SmallVectorImpl &strideInts, SmallVectorImpl &paddingInts, @@ -167,24 +168,29 @@ static LogicalResult createPoolingOp( } namespace { + +template struct DimensionTraits {}; + +template <> struct DimensionTraits { + static constexpr int64_t Dim = 2; + // unused const variable warning suppression: + static_assert(Dim == Dim); +}; + +template <> struct DimensionTraits { + static constexpr int64_t Dim = 3; + // unused const variable warning suppression: + static_assert(Dim == Dim); +}; + template class ConvertAtenMaxPoolOp : public OpConversionPattern { using OpConversionPattern::OpConversionPattern; private: - template struct DimensionTraits; - - template <> struct DimensionTraits { - static const int64_t Dim = 2; - }; - - template <> struct DimensionTraits { - static const int64_t Dim = 3; - }; - static const int64_t Dim = DimensionTraits::Dim; - LogicalResult createPoolingMax3D(AtenMaxPool3dOp &op, + LogicalResult createPoolingMax3D(AtenMaxPool3dOp &op, typename OpTy::Adaptor adaptor, ConversionPatternRewriter &rewriter, SmallVectorImpl &kernelSizeIntValues, @@ -327,9 +333,9 @@ class ConvertAtenMaxPoolOp : public OpConversionPattern { rewriter.replaceOpWithNewOp(op, newResultType, maxPool2d); return success(); } else { - return createPoolingMax3D(op, adaptor, rewriter, - kernelSizeIntValues, strideInts, paddingInts, - dilationInts, ceilMode); + return createPoolingMax3D(op, adaptor, rewriter, kernelSizeIntValues, + strideInts, paddingInts, dilationInts, + ceilMode); } } };