[all-commits] [llvm/llvm-project] e28a5c: [mlir][tosa] Fix dynamic shape inference in conv2d

Anastasia Stulova via All-commits all-commits at lists.llvm.org
Tue Sep 6 15:43:48 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e28a5ceca957ea0c40933db01cf0246c9c45bbe9
      https://github.com/llvm/llvm-project/commit/e28a5ceca957ea0c40933db01cf0246c9c45bbe9
  Author: Anastasia Stulova <Anastasia.Stulova at arm.com>
  Date:   2022-09-06 (Tue, 06 Sep 2022)

  Changed paths:
    M mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp
    M mlir/test/Conversion/TosaToLinalg/tosa-to-linalg-named.mlir

  Log Message:
  -----------
  [mlir][tosa] Fix dynamic shape inference in conv2d

The comment in the code correctly states the equation for the shape inference as follows:

```
H = ((IH+pad_top+pad_bottom-(dilation_y*(KH-1)+1))/stride_y)+1
```

However the final operation is generated as `-` instead of `+`. I believe `+`
is indeed correct. For example if we have an image with dimension 6 and kernel
of dimension 3 (assuming padding is 0 and stride and dilation are both 1) we
are expecting 4 elements in the output (computed for image elements `(0, 1, 2)
x kernel`, `(1, 2, 3) x kernel`, `(2, 3, 4) x kernel` and `(3, 4, 5) x kernel`.
However currently only 2 elements are produced in the output.

Reviewed By: NatashaKnk

Differential Revision: https://reviews.llvm.org/D133208




More information about the All-commits mailing list