-
Notifications
You must be signed in to change notification settings - Fork 767
docs: add examples for bool tensor operations #4248
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
base: main
Are you sure you want to change the base?
Conversation
Added documentation examples for: - bool_not - bool_and - bool_or - bool_xor Contributes to tracel-ai#2450
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project check has failed because the head coverage (69.03%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #4248 +/- ##
==========================================
+ Coverage 68.96% 69.03% +0.07%
==========================================
Files 1346 1409 +63
Lines 165578 165880 +302
==========================================
+ Hits 114192 114520 +328
+ Misses 51386 51360 -26 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
laggui
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contributing documentation 🙏
Minor comment on formatting, otherwise LGTM
| /// fn example<B: Backend>() { | ||
| /// let device = Default::default(); | ||
| /// let a = Tensor::<B, 2, Bool>::from_bool( | ||
| /// [[true, true], | ||
| /// [false, false]].into(), | ||
| /// &device, | ||
| /// ); | ||
| /// let b = Tensor::<B, 2, Bool>::from_bool( | ||
| /// [[true, false], | ||
| /// [true, false]].into(), | ||
| /// &device, | ||
| /// ); | ||
| /// let result = a.bool_and(b); | ||
| /// println!("{result}"); | ||
| /// // [[true, false], | ||
| /// // [false, false]] | ||
| /// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make the examples a bit more compact, we can fix the formatting following cargo fmt
fn example<B: Backend>() {
let device = Default::default();
let a = Tensor::<B, 2, Bool>::from_bool([[true, true], [false, false]].into(), &device);
let b = Tensor::<B, 2, Bool>::from_bool([[true, false], [true, false]].into(), &device);
let result = a.bool_and(b);
println!("{result}"); // [[true, false], [false, false]]
}for all examples
Summary
Added documentation examples for four boolean tensor operations in
burn-tensor:bool_not- Boolean inversionbool_and- Logical AND operationbool_or- Logical OR operationbool_xor- Logical XOR operationChanges
Added doc examples with:
Contributes to #2450