Repository navigation
Commit 0771c80
authored
Fix ops.tile shape inference issue on TensorFlow backend (#21860)
* Fix ops.tile shape inference issue on TensorFlow backend
When ops.tile is called inside a Layer's call method with concrete
integer repeats, the TensorFlow backend was converting those repeats
to a tensor, which prevented TensorFlow's shape inference from properly
determining the output shape. This resulted in all-None shapes.
Changes:
1. Modified TensorFlow backend's tile() to detect when repeats contains
only concrete integer values and pass them directly to tf.tile as a
Python list/tuple instead of converting to a tensor. This allows
TensorFlow's shape inference to work correctly.
2. Enhanced ops.numpy.Tile.compute_output_spec() to handle symbolic
repeat values more gracefully by checking if each repeat is a
concrete integer before attempting multiplication.
3. Added regression tests to verify shape inference works correctly
both in direct ops.tile calls and when used inside Layer.call().
Fixes #20914
Signed-off-by: Samaresh Kumar Singh <ssam3003@gmail.com>
* Fix code formatting
1. Fix line length issues in tensorflow/numpy.py
2. Remove extra blank lines
3. Use specific exception types instead of bare except
4. Improve docstring formatting
* Regenerate API files with proper formatting.
* Apply proper formatting via shell/api_gen.sh
* Address review comments: simplify tile implementation and refactor tests
* Remove unnecessary dynamic rank check
* Fix isinstance check to use x_size instead of repeat
* Skip tile shape inference test for OpenVINO backend
* Handle int repeats in tile function per review feedback
---------
Signed-off-by: Samaresh Kumar Singh <ssam3003@gmail.com>1 parent 024c96d commit 0771c80
3 files changed
Lines changed: 54 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2755 | 2755 | | |
2756 | 2756 | | |
2757 | 2757 | | |
2758 | | - | |
2759 | | - | |
2760 | | - | |
2761 | | - | |
2762 | | - | |
2763 | | - | |
2764 | | - | |
2765 | | - | |
2766 | | - | |
2767 | | - | |
2768 | | - | |
2769 | | - | |
2770 | | - | |
| 2758 | + | |
| 2759 | + | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
| 2764 | + | |
| 2765 | + | |
| 2766 | + | |
| 2767 | + | |
| 2768 | + | |
| 2769 | + | |
| 2770 | + | |
| 2771 | + | |
| 2772 | + | |
| 2773 | + | |
| 2774 | + | |
| 2775 | + | |
| 2776 | + | |
| 2777 | + | |
| 2778 | + | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
| 2782 | + | |
| 2783 | + | |
| 2784 | + | |
2771 | 2785 | | |
2772 | 2786 | | |
2773 | 2787 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6451 | 6451 | | |
6452 | 6452 | | |
6453 | 6453 | | |
| 6454 | + | |
| 6455 | + | |
| 6456 | + | |
6454 | 6457 | | |
6455 | 6458 | | |
6456 | 6459 | | |
6457 | 6460 | | |
6458 | 6461 | | |
6459 | 6462 | | |
6460 | 6463 | | |
6461 | | - | |
6462 | | - | |
6463 | | - | |
| 6464 | + | |
6464 | 6465 | | |
| 6466 | + | |
| 6467 | + | |
6465 | 6468 | | |
6466 | 6469 | | |
6467 | 6470 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1840 | 1840 | | |
1841 | 1841 | | |
1842 | 1842 | | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
1843 | 1847 | | |
1844 | 1848 | | |
1845 | 1849 | | |
| |||
9614 | 9618 | | |
9615 | 9619 | | |
9616 | 9620 | | |
| 9621 | + | |
| 9622 | + | |
| 9623 | + | |
| 9624 | + | |
| 9625 | + | |
| 9626 | + | |
| 9627 | + | |
| 9628 | + | |
| 9629 | + | |
| 9630 | + | |
| 9631 | + | |
| 9632 | + | |
| 9633 | + | |
| 9634 | + | |
| 9635 | + | |
| 9636 | + | |
| 9637 | + | |
0 commit comments