Skip to content
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

Generate Assertion Ops for interpolate_bilinear #2609

Merged
merged 1 commit into from
Nov 19, 2021

Conversation

faizan-m
Copy link
Member

@faizan-m faizan-m commented Nov 18, 2021

Description

Enables the assertions to be included as part of the traced graph allowing functions traced with shapeless Tensors to be used for shaped instances and throw the proper exceptions.

Removed test_symbolic_tensor_shape because it is not supported as per KerasTensor update.

This CL prevents the updated code from being broken on the rollout of enabling subtyping for tf.function.

Fixes # (issue)

Type of change

Checklist:

  • I've properly formatted my code according to the guidelines
    • By running Black + Flake8
    • By running pre-commit hooks
  • This PR addresses an already submitted issue for TensorFlow Addons
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • This PR contains modifications to C++ custom-ops

How Has This Been Tested?

If you're adding a bugfix or new feature please describe the tests that you ran to verify your changes:
*

@bhack
Copy link
Contributor

bhack commented Nov 18, 2021

Many SIG members have no visibility to the internal CL

@faizan-m
Copy link
Member Author

Hi bhack!

Sorry about that! I have added more details!

@bhack
Copy link
Contributor

bhack commented Nov 18, 2021

Enables the assertions to be included as part of the traced graph allowing functions traced with shapeless Tensors to be used for shaped instances and throw the proper exceptions.

I understand this but do we have this documented somewhere?

@faizan-m
Copy link
Member Author

I am confused regarding what documentation would be ideal here?

To put another way, there is currently a bug in the code. If you have a generalized function:
fn = interpolate_bilinear.get_concrete_function(
tf.TensorSpec(shape=None, dtype=tf.float32),
tf.TensorSpec(shape=None, dtype=tf.float32),
)
And you call it on an invalid shape, say [1, 2, 1, 1]. Then error you get is not "Grid width must be at least 2." but "indices[0,0] = -1 is not in [0, 2)" that is being generated at a much lower level and is difficult to understand.

@bhack
Copy link
Contributor

bhack commented Nov 18, 2021

Ok, we have some failing test.

tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[0,0] = -1 is not in [0, 2)

@faizan-m faizan-m force-pushed the gen_assertions branch 2 times, most recently from 8e68a1d to 85a302d Compare November 18, 2021 07:03
@faizan-m
Copy link
Member Author

Yeah those probably come from: #138

I think tf.function is stochastically parallelizing the asserts (which it shouldn't) leading to the flakiness.

I fixed them by using explicit control dependencies but it appears that the code compliance check is not happy with that. Even if the assert bug is fixed at head, the flakiness will persist for previous TF versions. So I think for the sake of code functionality, we should consider adding this file to the exceptions list.

@boring-cyborg boring-cyborg bot added the test-cases Related to Addons tests label Nov 18, 2021
@bhack bhack merged commit e2ae50d into tensorflow:master Nov 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes image test-cases Related to Addons tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants