torch-mlir/lib/Dialect/Torch/Transforms
yyp0 22cd4441e7
[Torch] Add support for static uneven divisible AdaptiveAvgPool2d (#3566)
The static uneven divisible AdaptiveAvgPool2d means that although the
input size is not an integer multiple of ouput size, but the kernel and
stride size can also be fixed (not dynamic). The derivation logic of
kernel and stride size is consistent with
torch/_decomp/decomposations.py:adaptive_avg_pool2d as described in the
following:

1. Stride Size
Firstly , derive the start index in each reduce operation according to
the output size (`n`), `start_index = ([0, 1, ..., n - 1] * input_size)
// output_size`. For each index `k`, if `k * (input_size % output_size)
< output_size`, then the current and previous stride keeps the same as
`input_size // output_size`. So suppose `(n-1) * (input_size %
output_size) < output_size`, the stride in the whole AdaptiveAvgPool2d
process keeps static, as `input_size // output_size`.

2. Kernel Size
torch/_decomp/decomposations.py:adaptive_avg_pool2d calculates a static
kernel size when the input/output sizes satisfy either of the two
conditions, `input_size % output_size == 0` or `output_size %
(input_size % output_size) == 0`. Here if `input_size % output_size ==
0`, then the kernel size equals `input_size // output_size`, otherwise
`input_size // output_size + 1.`
2024-08-01 11:37:53 +08:00
..
AbstractInterpLibrary.cpp `max_unpool3d` linalg lowering (#3536) 2024-07-30 20:59:17 +03:00
AdjustCallingConventions.cpp Update to llvm/llvm-proect@27ac46e6be (2024-6-12) (#3454) 2024-06-12 19:34:01 -07:00
CMakeLists.txt [torch] Improve shape inference for `torch-to-linalg` path for reshapes (#3055) 2024-03-26 12:41:40 -07:00
DecomposeComplexOps.cpp [Torch] Add support for static uneven divisible AdaptiveAvgPool2d (#3566) 2024-08-01 11:37:53 +08:00
DropAbstractInterpCalculations.cpp Update to LLVM 029313cc979ae71877b65794b1063d4e51184cc8 2023-03-21 04:16:20 -07:00
EraseModuleInitializer.cpp [NFC] Remove unused header files (#3386) 2024-05-30 14:30:36 +08:00
FuseQuantizedOps.cpp Adds misc fixes for some padding related issues (#3528) 2024-07-11 20:01:45 -05:00
GlobalizeObjectGraph.cpp [NFC] Remove unused header files (#3386) 2024-05-30 14:30:36 +08:00
InlineGlobalSlots.cpp [NFC] Change to *cast instead of .*cast variants (#3405) 2024-05-30 23:45:13 -07:00
LowerToBackendContract.cpp [Torch] Add AtenMaskedFillTensorOp support (#3561) 2024-07-26 15:32:13 +08:00
MatchQuantizedOps.cpp [ONNX] add int16 quantization support (#3446) 2024-06-12 10:37:22 +05:30
MaximizeValueSemantics.cpp [NFC] Change to *cast instead of .*cast variants (#3405) 2024-05-30 23:45:13 -07:00
PassDetail.h llvm: bump tag to e1318078 (#781) 2022-04-26 12:27:51 -07:00
Passes.cpp [Pipeline] Use dedicated simplification pipeline for TorchDynamo frontend (#3376) 2024-05-22 05:23:18 -07:00
PrepareForGlobalizeObjectGraph.cpp [NFC] Remove unused header files (#3386) 2024-05-30 14:30:36 +08:00
RecomposeComplexOps.cpp [Torch] Add support for Meshgrid (#3462) 2024-06-14 23:59:08 +08:00
ReduceOpVariants.cpp [NFC] Change to *cast instead of .*cast variants (#3405) 2024-05-30 23:45:13 -07:00
RefinePublicReturn.cpp [NFC] Remove unused header files (#3386) 2024-05-30 14:30:36 +08:00
ReifyAbstractInterpCalculationsUtils.cpp [NFC] Change to *cast instead of .*cast variants (#3405) 2024-05-30 23:45:13 -07:00
ReifyAbstractInterpCalculationsUtils.h handles 2,3,4 from https://github.com/llvm/torch-mlir/issues/1963 (#1964) 2023-03-24 21:50:01 -05:00
ReifyDtypeCalculations.cpp Fix deprecated uses of cast/dyn_cast/dyn_cast_or_null/isa (#3243) 2024-04-27 14:00:56 -07:00
ReifyShapeCalculations.cpp Fix deprecated uses of cast/dyn_cast/dyn_cast_or_null/isa (#3243) 2024-04-27 14:00:56 -07:00
ScalarizeShapes.cpp [NFC] Remove unused header files (#3386) 2024-05-30 14:30:36 +08:00
SimplifyAbstractInterpCalculationsUtils.cpp Fix deprecated uses of cast/dyn_cast/dyn_cast_or_null/isa (#3243) 2024-04-27 14:00:56 -07:00
SimplifyAbstractInterpCalculationsUtils.h Replace RefineTypes with dtype functions (#2105) 2023-05-12 13:40:45 -07:00
SimplifyDtypeCalculations.cpp [NFC] Change to *cast instead of .*cast variants (#3405) 2024-05-30 23:45:13 -07:00
SimplifyShapeCalculations.cpp [NFC] Change to *cast instead of .*cast variants (#3405) 2024-05-30 23:45:13 -07:00