Open dgolubovicTT opened 3 days ago
The reason why transpose gives float32 on output is because of its definition in tm.py. Namely transpose has an argument out_dtype where you can specify output type. This attribute is torch.float32 by default. This is the reason why transpose gives float32 output and causes mismatch.
We need to remove this.
Repro:
checkout: dgolubovic/repro-tensor-mismatch-due-to-bfloat16
Run: pytest -svv forge/test/mlir/test_ops.py::test_transpose[params0]
ERROR | forge.op.eval.common:compare_with_golden_pcc:245 - Tensor mismatch
What we get is tensor missmatch between framework output and compiled model. What is strange that initial graph of compiler has output df float32 even though we casted it to bfloat16:
TODO: Investigate the cause of missmatch and why output dataformat is float32...
This is not currently blocker to anything but it may increase priority if we want to transfer all models to compile at bfloat16 dataformat...