-
Notifications
You must be signed in to change notification settings - Fork 0
Add support to more feasiable function to.
#23
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
Conversation
3e97afa to
cc44007
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #23 +/- ##
==========================================
+ Coverage 28.81% 38.57% +9.76%
==========================================
Files 3 3
Lines 177 197 +20
Branches 19 26 +7
==========================================
+ Hits 51 76 +25
+ Misses 126 121 -5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f716d8a to
fb4141e
Compare
fb4141e to
bc1d886
Compare
bc1d886 to
f62c660
Compare
f62c660 to
9508f04
Compare
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.
Pull Request Overview
This PR enhances the to method of the ParityTensor class to support more flexible conversion options, including device and dtype conversions with multiple parameter formats. The method now accepts positional arguments for device/dtype specifications alongside keyword arguments.
- Expands the
tomethod signature to accepttorch.device,torch.dtype, or string parameters - Adds comprehensive test coverage for various parameter combinations and error cases
- Implements validation to prevent duplicate parameter specifications
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| parity_tensor/parity_tensor.py | Enhanced to method with flexible parameter handling and dtype conversion support |
| tests/conversion_test.py | Added comprehensive test suite covering parameter combinations and edge cases |
Comments suppressed due to low confidence (2)
tests/conversion_test.py:41
- The condition
len(args) <= 1means cases with 2 positional arguments (device + dtype) are never tested, leaving important functionality uncovered.
if len(args) <= 1:
parity_tensor/parity_tensor.py:67
- The parameter name
whateveris unclear and unprofessional. Consider renaming it to something more descriptive liketargetordestination.
def to(self, whatever: torch.device | torch.dtype | str | None = None, *, device: torch.device | None = None, dtype: torch.dtype | None = None) -> ParityTensor:
No description provided.