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

#14448: Update examples of binary ops #14468

Merged
merged 1 commit into from
Oct 30, 2024
Merged

Conversation

mcw-anasuya
Copy link
Contributor

@mcw-anasuya mcw-anasuya commented Oct 30, 2024

Ticket

#14448

Problem description

Shape in examples inconsistent with op.
Currently we support device operations for ranks > 2 as per doc. The example in the doc creates a 1D tensor.

What's changed

  • Updated examples to create 2D tensors in documentation of binary ops.
  • Updated args wordings of polyval, isclose

Checklist

>>> tensor1 = ttnn.to_device(ttnn.from_torch(torch.tensor((1, 2), dtype=torch.bfloat16)), device)
>>> tensor2 = ttnn.to_device(ttnn.from_torch(torch.tensor((0, 1), dtype=torch.bfloat16)), device)
>>> tensor1 = ttnn.to_device(ttnn.from_torch(torch.tensor(([[1, 2], [3, 4]]), dtype=torch.bfloat16)), device)
>>> tensor2 = ttnn.to_device(ttnn.from_torch(torch.tensor(([[1, 2], [3, 4]]), dtype=torch.bfloat16)), device)
>>> output = {1}(tensor1, tensor2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the issue ? Is it zero or the format how it passed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The format that we passed.
torch.tensor((1, 2), dtype=torch.bfloat16) creates a tensor of rank 1 with elements [1 2].
According to the documentation, most of the ops support ranks of 2, 3, 4. That's why we passed the input as
[1 2
3 4]

Copy link
Contributor

@Aswinmcw Aswinmcw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mcw-anasuya mcw-anasuya force-pushed the anasuya/update_binary_example branch from 345d5ee to f8de925 Compare October 30, 2024 15:49
@mcw-anasuya mcw-anasuya force-pushed the anasuya/update_binary_example branch from f8de925 to a1eb0fa Compare October 30, 2024 16:32
@mcw-anasuya mcw-anasuya merged commit 058a4c3 into main Oct 30, 2024
8 checks passed
@mcw-anasuya mcw-anasuya deleted the anasuya/update_binary_example branch October 30, 2024 16:45
ct-clmsn pushed a commit to ct-clmsn/tt-metal that referenced this pull request Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants