| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Codecov Report❌ Patch coverage is 97.40260% with 2 lines in your changes missing coverage. Please review.
@@ Coverage Diff @@
## main #2843 +/- ##
==========================================
- Coverage 78.97% 78.97% -0.01%
==========================================
Files 248 248
Lines 50901 50936 +35
Branches 4395 4404 +9
==========================================
+ Hits 40199 40226 +27
- Misses 9904 9909 +5
- Partials 798 801 +3 ☔ View full report in Codecov by Sentry.
|
Sorry, something went wrong.
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Sorry, something went wrong.
There was a problem hiding this comment.
there's quite a few changes here, but not as many new tests covering them?
Sorry, something went wrong.
| for i in self._args_diff))) | ||
| if not self._args_diff: | ||
| return DimensionTuple() | ||
| # Get indices of all args and merge them |
There was a problem hiding this comment.
nitpicking: blank line
Sorry, something went wrong.
| for a in self._args_diff: | ||
| for d, i in a.indices.getters.items(): | ||
| mapper.setdefault(d, []).append(i) | ||
| # Filter unique indices |
There was a problem hiding this comment.
nitpicking: blank line
Sorry, something went wrong.
| # Filter unique indices | ||
| mapper = {k: v[0] if len(v) == 1 else tuple(filter_ordered(v)) | ||
| for k, v in mapper.items()} | ||
| return DimensionTuple(*mapper.values(), getters=tuple(mapper.keys())) |
There was a problem hiding this comment.
nitpicking: blank line
Sorry, something went wrong.
There was a problem hiding this comment.
nitpicking: can just be getters=tuple(mapper)
Sorry, something went wrong.
| def dimensions(self): | ||
| return tuple(filter_ordered(flatten(getattr(i, 'dimensions', ()) | ||
| for i in self._args_diff))) | ||
| if not self._args_diff: |
There was a problem hiding this comment.
why do we need these two lines? highest_priority(self).dimensions should already return it, or there's something non-consistent about it
Sorry, something went wrong.
There was a problem hiding this comment.
Because a generic Differentiable does not necessarily has an _args_diff. For. example 1/h_x is a Differentiable but it doesn't have any argument that is Differentiable
Sorry, something went wrong.
There was a problem hiding this comment.
but the property is still there, it's not that you are exposing yourself to an AttributeError... so (1/h_x)._args_diff will return the empty tuple and it should just be fine no?
Sorry, something went wrong.
There was a problem hiding this comment.
An empty tuple doesn't have a .staggered or .dimension property. And on top of it (1/h_x)._args_diff will return 1/h_x which wiull be an infinite recursion
Sorry, something went wrong.
|
|
||
| @cached_property | ||
| def staggered(self): | ||
| if not self._args_diff: |
There was a problem hiding this comment.
same story as before, I think
... unless I'm missing something
Sorry, something went wrong.
There was a problem hiding this comment.
same
Sorry, something went wrong.
| def highest_priority(DiffOp): | ||
| if not DiffOp._args_diff: | ||
| return DiffOp | ||
| # We want to get the object with highest priority |
There was a problem hiding this comment.
blank line
Sorry, something went wrong.
| @@ -475,12 +487,19 @@ def has_free(self, *patterns): | |||
|
|
|||
|
|
|||
| def highest_priority(DiffOp): | |||
There was a problem hiding this comment.
small letters diff_op as it's an instance
Sorry, something went wrong.
|
|
||
| @interp_for_fd.register(Mul) | ||
| def _(expr, x0, **kwargs): | ||
| # For a expression (e.g Mul or Add), we interpolate the whole expression |
There was a problem hiding this comment.
"an expression"
so the comment says "Mul or Add" but the dispatcher only targets Mul. Is it expected?
Sorry, something went wrong.
| # Filter unique indices | ||
| mapper = {k: v[0] if len(v) == 1 else tuple(filter_ordered(v)) | ||
| for k, v in mapper.items()} | ||
| return DimensionTuple(*mapper.values(), getters=tuple(mapper.keys())) |
There was a problem hiding this comment.
nitpicking: can just be getters=tuple(mapper)
Sorry, something went wrong.
|
|
||
| # Split args between those that need interp and those that don't | ||
| def test0(a): | ||
| return all(a.indices[d] is i for d, i in x0.items() if d in a.dimensions) |
There was a problem hiding this comment.
nitpick: blank line
Sorry, something went wrong.
| f"'{expr}' must be of type Differentiable, not {type(expr)}" | ||
| ) from None | ||
| except Exception as e: | ||
| raise type(e)(f"Error while computing finite-difference for expr={expr}: " |
There was a problem hiding this comment.
Reporting the type of expr here would make this error message more useful
Sorry, something went wrong.
There was a problem hiding this comment.
Not sure what you mean the message is raise type(e) ... that's type already
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
No description provided.