Skip to content

Conversation

@qburke
Copy link

@qburke qburke commented Dec 24, 2025

Summary

Added documentation examples for four boolean tensor operations in burn-tensor:

  • bool_not - Boolean inversion
  • bool_and - Logical AND operation
  • bool_or - Logical OR operation
  • bool_xor - Logical XOR operation

Changes

Added doc examples with:

  • Clear descriptions of what each operation does
  • Arguments and Returns sections
  • Code examples
  • Expected output in comments

Contributes to #2450

Added documentation examples for:
- bool_not
- bool_and
- bool_or
- bool_xor

Contributes to tracel-ai#2450
@codecov
Copy link

codecov bot commented Dec 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.03%. Comparing base (91dd62c) to head (7633b4f).
⚠️ Report is 6 commits behind head on main.

❌ 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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@laggui laggui left a 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

Comment on lines 78 to 94
/// 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]]
/// }
Copy link
Member

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

@qburke qburke requested a review from laggui January 4, 2026 19:05
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.

2 participants