torch-mlir/lib/Dialect/Torch/Transforms
Gaurav Shukla e57d3f9774 [LINALG] Fix `aten.bernoulli` op lowering
- This commit adds E2E support for `aten.rand_like` and
  `aten.bernoulli_.Tensor` ops.
- The `aten.bernoulli(x)` was implemented as:
  `aten.bernoulli(x) = rand_like(x) < 0.5`, assuming 0.5 as default
  probability, whereas according to the pytorch documentation:
  https://pytorch.org/docs/stable/generated/torch.bernoulli.html#torch.bernoulli
  the input x in `aten.bernoulli(x)` is itself a tensor containing
  probabilities to be used for drawing the binary random number.
- So this commit fixes the `aten.bernoulli(x)` implementation as:
  `aten.bernoulli(x) = rand_like(x) < x`.
- It also fixes the case where the input to `aten.bernoulli_.float` is
  an integer tensor. In this case the input must be casted to float type
  before passing it as operand to `aten.rand_like` op.
  `aten.bernoulli_.float(x, p) = rand_like(float(x)) < p`.

Signed-Off-by: Gaurav Shukla <gaurav@nod-labs.com>
2022-03-05 09:38:22 +05:30
..
AdjustCallingConventions.cpp Bump LLVM to 881ff4e4ebe8cc0cc045c7c167cffb01f94f27f8 (#539) 2022-01-25 22:16:30 -08:00
CMakeLists.txt E2e support for aten.softmax.int and aten.embedding 2021-10-18 17:57:45 -04:00
DecomposeComplexOps.cpp [LINALG] Fix `aten.bernoulli` op lowering 2022-03-05 09:38:22 +05:30
GlobalizeObjectGraph.cpp Bump LLVM to 84fe34a0b7fdd7bbf179981d1583693d5d5ec68b (#544) 2022-01-27 17:21:09 -08:00
InlineGlobalSlots.cpp Dual license the torch-mlir project. 2021-10-01 10:46:08 -07:00
MaximizeValueSemantics.cpp Add operand type invariant to `torch.overwrite.tensor.contents` (#606) 2022-02-22 11:41:46 -08:00
PassDetail.h Dual license the torch-mlir project. 2021-10-01 10:46:08 -07:00
Passes.cpp Add support for multiple return values 2021-11-16 21:07:45 -05:00
PrepareForGlobalizeObjectGraph.cpp Dual license the torch-mlir project. 2021-10-01 10:46:08 -07:00
ReduceOpVariants.cpp [LINALG] Fix `aten.bernoulli` op lowering 2022-03-05 09:38:22 +05:30
RefinePublicReturn.cpp Dual license the torch-mlir project. 2021-10-01 10:46:08 -07:00
RefineTypes.cpp [LINALG] Fix `aten.bernoulli` op lowering 2022-03-05 09:38:22 +05:30