-
Notifications
You must be signed in to change notification settings - Fork 74.1k
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
Default EQUALITY_OPERATORS in Autograph #55317
Conversation
I've extended an high level integration test. |
tensorflow/python/autograph/converters/logical_expressions_test.py
Outdated
Show resolved
Hide resolved
Copybara again |
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.
BTW, I finally exported the integration tests - they're now under autograph/tests
.
tensorflow/python/autograph/converters/logical_expressions_test.py
Outdated
Show resolved
Hide resolved
from tensorflow.python.framework import test_util | ||
from tensorflow.python.platform import test | ||
|
||
|
||
class LogicalExpressionTest(converter_testing.TestCase): | ||
|
||
def test_equals(self): | ||
|
||
|
||
def f(a, b): | ||
return a == b |
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.
What is see here is that here in the test this a python bool
.
Where in a standard gist like this is a bool
Tensor
def test(a, b):
print(a == b)
return a == b
a = tf.constant([1])
b = 2
test(a, b)
tf.Tensor([ True], shape=(1,), dtype=bool)
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.
That's in a standalone shell, right? The unit test might be running in different conditions, likely in graph mode. I fear the best way to debug the error is to run the test, with both --test_env=TF2_BEHAVIOR=1
and =0
...
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.
That's in a standalone shell, right
it was on colab of course in graph mode was Tensor("Equal:0", shape=(1,), dtype=bool)
that is the similar when in the test I use another operator like e.g. >=
--test_env=TF2_BEHAVIOR=1 and =0
It always print a Python bool in the test
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.
I have committed an alternative test and it is passing. You can compare the results in the log.
If there is something not working in ops.enable_tensor_equality()
I suppose that it need to be covered with an additional use case in its test file:
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/eager/core_test.py#L92
PiperOrigin-RevId: 438657781
P.s. Ok I found it on |
Yes, it's strange that GH didn't automatically marked it as merged. Probably due to the internal revisions. |
fix #55278
/cc @mdanatg Let me know where do you want to move the test so that I write it like an integration test as where is now it will go to fail for missing variable conversion (
ag__.ld
).