After #538's graceful-degradation fix, _take_long_axis (tf2_test_take_along_axis.py) produces 9 distinct tensor-typed local values in the analysis, where only ~2 are user-visible (row_indices, gather_indices). The other 7 are intermediates introduced by the tf.shape → tf.range/tile/concat → tf.reshape runtime-shape idiom.
This surfaced when the testTakeAlongAxis regression guard flipped from @Test(expected = IllegalStateException.class) to plain @Test. The post-fix Javadoc TODO on that test points at this issue.
Per-value-number counting picks up every SSA temp that the analysis labels as a tensor, including runtime-shape arithmetic. The 9 is harmless for correctness (the test still pins the parameter types precisely: arr → (2, 3) float32, indices → (2, 2) int32) but means the local-tensor count is a loose regression guard rather than a tight one.
Possible directions
- Exclude runtime-shape intermediates from
functionTensorVariables (e.g., results of tf.shape, tf.size, tf.rank and downstream tf.range/tf.tile chains).
- Recognize the
tf.shape → tf.range/tile/concat → tf.reshape idiom as a unit and collapse it.
- Switch the count to per-source-line rather than per-value-number — closer to what a user reads.
Pointer
Test that documents the loose bound (and will be tightened when this is fixed): TestTensorflow2Model.testTakeAlongAxis, currently expecting 9 locals.
After #538's graceful-degradation fix,
_take_long_axis(tf2_test_take_along_axis.py) produces 9 distinct tensor-typed local values in the analysis, where only ~2 are user-visible (row_indices,gather_indices). The other 7 are intermediates introduced by thetf.shape → tf.range/tile/concat → tf.reshaperuntime-shape idiom.This surfaced when the
testTakeAlongAxisregression guard flipped from@Test(expected = IllegalStateException.class)to plain@Test. The post-fix Javadoc TODO on that test points at this issue.Per-value-number counting picks up every SSA temp that the analysis labels as a tensor, including runtime-shape arithmetic. The 9 is harmless for correctness (the test still pins the parameter types precisely:
arr→(2, 3) float32,indices→(2, 2) int32) but means the local-tensor count is a loose regression guard rather than a tight one.Possible directions
functionTensorVariables(e.g., results oftf.shape,tf.size,tf.rankand downstreamtf.range/tf.tilechains).tf.shape → tf.range/tile/concat → tf.reshapeidiom as a unit and collapse it.Pointer
Test that documents the loose bound (and will be tightened when this is fixed):
TestTensorflow2Model.testTakeAlongAxis, currently expecting 9 locals.