Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ttnn.where (and eltwise ops in general) mixed data types issue #17998

Open
azecevicTT opened this issue Feb 19, 2025 · 1 comment
Open

ttnn.where (and eltwise ops in general) mixed data types issue #17998

azecevicTT opened this issue Feb 19, 2025 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@azecevicTT
Copy link

As title says issue is related to behaviour of (binary) eltwise ops in the presence of mixed data type operands. Correct me if I'm wrong but currently the result's data type will default to the data type of the first operand, which leads to some weird cases like:

ttnn.add(bf16, f32) -> bf16
ttnn.add(f32, bf16) -> f32

Most frameworks would default to f32 in both cases. Is there an initiative to make eltwise ops work like this in TTNN?

Related to that is the behaviour of ttnn.where. The data type of the result will always be the data type of condition operand, which is a bit weird, and not what most people would expect. Just by switching the order of condition and value https://github.com/tenstorrent/tt-metal/blob/main/ttnn/cpp/ttnn/operations/eltwise/ternary/where.cpp#L37 leads to more expected result (though it might cause some other issues). I believe ttnn.where is a bit special in that regard, even if you want to make case for strongly typed operations where mixed types are considered errors, while it's reasonable to assume true_value and false_value have the same data type, I believe that condition's data type should be independent of them (and consequently the result's data type).

@AleksKnezevic
Copy link
Contributor

@cmaryanTT, could we get an ETA?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants