-
Notifications
You must be signed in to change notification settings - Fork 247
api: fix kwargs processing for tensor functions #2604
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
devito/types/basic.py
Outdated
| @classmethod | ||
| def _sympify(self, arg): | ||
| # This is used internally by sympy to process arguments at rebuilt. And since | ||
| # some of our property are non-sympyfiable we need to make sure we have a fallback |
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.
*properties
devito/types/tensor.py
Outdated
| return orders | ||
| else: | ||
| return orders[0] | ||
| # return ({a.space_order for a in self} - {None}).pop() |
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.
leftover
d8bfd46 to
1dd5f5a
Compare
devito/types/tensor.py
Outdated
| for k, v in kwargs.items(): | ||
| if isinstance(v, MatrixBase): | ||
| sub_kwargs[k] = v[i, j] | ||
| else: |
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.
it's imho one of those cases in which elif isinstance(v, <what's needed here>): .... else: .... would read more smoothly than a nested try-except (but I'm nitpicking here)
devito/types/tensor.py
Outdated
| # Setup kwargs for subfunction | ||
| # Through rebuilding or user input, the kwargs could be | ||
| # Tensors as well from a per-component property | ||
| sub_kwargs = {} |
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.
seems redundant, perhaps factor out in a utility function? or a private method?
18d1f9b to
0f421b6
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2604 +/- ##
==========================================
- Coverage 91.91% 91.91% -0.01%
==========================================
Files 245 245
Lines 48403 48427 +24
Branches 4252 4255 +3
==========================================
+ Hits 44491 44513 +22
- Misses 3235 3237 +2
Partials 677 677
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fix handling of tensor kwargs when they are provided as per-compoenent