Conversation
343b4d0 to
859b387
Compare
74e42b4 to
bd1c612
Compare
|
This is ready. The time taken by the |
inducer
left a comment
There was a problem hiding this comment.
Thanks for working on this! A few questions below, but generally this looks good.
pytato/transform.py
Outdated
| raise NotImplementedError | ||
|
|
||
| def map_placeholder(self, expr1: Placeholder, expr2: Any) -> bool: | ||
| return (isinstance(expr2, Placeholder) |
There was a problem hiding this comment.
isinstance isn't precise enough, since the object might compare equal to its subclass. I think the types need to match. (Yes, that was a bug in the original __eq__.)
There was a problem hiding this comment.
Went with expr1.__class__ is expr2.__class__
7847d63 to
4ee85e3
Compare
4ee85e3 to
2b47d9a
Compare
inducer
left a comment
There was a problem hiding this comment.
Thanks! A few more superficial bits, then this is good to go.
pytato/equality.py
Outdated
|
|
||
| def handle_unsupported_array(self, expr1: Array, | ||
| expr2: Any) -> bool: | ||
| raise NotImplementedError |
There was a problem hiding this comment.
I think it'd be good to have an intelligible messages here.
There was a problem hiding this comment.
Added the type name. Thanks!
pytato/equality.py
Outdated
| raise NotImplementedError | ||
|
|
||
| def map_foreign(self, expr1: Any, expr2: Any) -> bool: | ||
| raise NotImplementedError |
There was a problem hiding this comment.
I think it'd be good to have an intelligible messages here.
There was a problem hiding this comment.
Added the type name. Thanks!
pytato/equality.py
Outdated
| from pytato.loopy import LoopyCall | ||
|
|
||
| __doc__ = """ | ||
| .. currentmodule:: pytato.equality |
There was a problem hiding this comment.
| .. currentmodule:: pytato.equality |
(not needed)
| if TYPE_CHECKING: | ||
| from pytato.loopy import LoopyCall | ||
|
|
||
| __doc__ = """ |
There was a problem hiding this comment.
Should this be hooked into the external docs somewhere?
pytato/equality.py
Outdated
| # }}} | ||
|
|
||
|
|
||
| def is_structurally_equivalent(expr1: ArrayOrNames, expr2: Any) -> bool: |
There was a problem hiding this comment.
- Not loving the name.
equivalentsuggests something more restrictive than equal. - Why not just call
EqualityComparisonMapper()(expr1, expr2)in__eq__?
There was a problem hiding this comment.
Ok, got rid of it.
pytato/equality.py
Outdated
|
|
||
| # {{{ EqualityComparisonMapper | ||
|
|
||
| class EqualityComparisonMapper: |
There was a problem hiding this comment.
| class EqualityComparisonMapper: | |
| class EqualityComparer: |
?
pytato/equality.py
Outdated
| .. note:: | ||
|
|
||
| Complexity: :math:`O(N)`, where :math:`N` is the number of nodes in | ||
| *expr1*. |
There was a problem hiding this comment.
This could get moved to the EqualityComparer docstring.
| # {{{ EqualityComparisonMapper | ||
|
|
||
| class EqualityComparisonMapper: | ||
| def __init__(self) -> None: |
There was a problem hiding this comment.
Add a docstring justifying why this object exists (to host caches for equality comparison, and that comparison might be exponential without it).
Co-authored-by: Andreas Kloeckner <inform@tiker.net>
2b47d9a to
1d31563
Compare
|
Thanks! |
Closes #163