torch-mlir/lib/Conversion/TorchToLinalg
Ashay Rane a893c7d5cf
Add shape transfer function and lowering to linalg for aten.neg (#759)
* shape: add shape transfer function for aten.neg

Prior to this patch, the list of shape transfer functions did not
include `aten.neg`, which resulted in errors like below.

```
error: unsupported by backend lowering: tensor with unknown rank or dtype
note: see current operation: %0 = "torch.aten.neg"(%arg0) :
  (!torch.vtensor<[256,256],f32>) -> !torch.vtensor<*,f32>
note: this is likely due to a missing shape transfer function in shape_lib_gen.py
```

This patch fixes the problem by adding a shape transfer function to
reflect the point-wise nature of this operation.

* linalg: add translation of aten.neg operation

This patch adds a translation rule to lower `aten.neg` operations on
tensors to an `arith.negf` operation wrapped inside a `linalg.generic`
operation.  This patch also adds a rudimentary test.
2022-04-15 11:11:22 -07:00
..
CMakeLists.txt Split up TorchToLinalg.cpp 2022-03-14 10:19:41 -07:00
DataMovement.cpp [MLIR][TORCH] Add support for same input and output shapes for view op 2022-03-25 22:26:10 +05:30
IndirectDataMovement.cpp Split up TorchToLinalg.cpp 2022-03-14 10:19:41 -07:00
Linear.cpp Add 2D case for convolution (#693) 2022-04-08 00:47:57 -04:00
Pooling.cpp Split up TorchToLinalg.cpp 2022-03-14 10:19:41 -07:00
PopulatePatterns.h Split up TorchToLinalg.cpp 2022-03-14 10:19:41 -07:00
Random.cpp Improve "pseudo" op terminology. 2022-03-15 17:57:52 -07:00
Reduction.cpp Split up TorchToLinalg.cpp 2022-03-14 10:19:41 -07:00
TensorConstructors.cpp [LINALG] Add torch.layout information 2022-04-07 20:47:49 +05:30
TensorScalarInterop.cpp Split up TorchToLinalg.cpp 2022-03-14 10:19:41 -07:00
TorchToLinalg.cpp Bump LLVM at 8361c5da30588d3d4a48eae648f53be1feb5cfad 2022-03-18 13:16:14 -04:00
Uncategorized.cpp Add shape transfer function and lowering to linalg for aten.neg (#759) 2022-04-15 11:11:22 -07:00
Utils.cpp Split up TorchToLinalg.cpp 2022-03-14 10:19:41 -07:00
Utils.h Split up TorchToLinalg.cpp 2022-03-14 10:19:41 -07:00