Summary
The Slice generator added in #568 forwards the input dtype but leaves the output shape at ⊤. For a tf.slice(input_, begin, size) call with constant begin/size, the output shape is computable per axis:
output.shape[i] = size[i] if size[i] >= 0
= input_.shape[i] - begin[i] if size[i] == -1 ("all remaining")
so a constant size with no -1 entries gives a fully concrete shape, and a -1 entry needs the corresponding input dim and begin[i].
Distinct from #406
This is the tf.slice API (the Slice generator reading the begin/size argument tensors), not the ndarray subscript-slice vocabulary (x[a:b:s]) that #406 covers via NdarraySubscriptOperation. The two are conceptually related but live on different code paths, so they need separate trackers.
Direction
In Slice.getDefaultShapes, resolve the begin and size argument points-to sets to constant integer lists (mirroring how ExpandDims resolves its axis ConstantKeys), fetch the input_ shape via the existing arg-shape helpers, and apply the per-axis formula above. Emit ⊤ (return null) when begin/size aren't constant or the needed input dim is unknown.
Use-case anchors
crf_forward's inputs/state parameters (tf2_test_crf.py): sourced from tf.slice (and tf.squeeze of a slice), currently float32/⊤; runtime shapes are (2, 2, 4) and (2, 4).
crf_binary_score's start_tag_indices/end_tag_indices/truncated_masks: tf.slice results, currently ⊤ int32/bool.
Summary
The
Slicegenerator added in #568 forwards the input dtype but leaves the output shape at ⊤. For atf.slice(input_, begin, size)call with constantbegin/size, the output shape is computable per axis:so a constant
sizewith no-1entries gives a fully concrete shape, and a-1entry needs the corresponding input dim andbegin[i].Distinct from #406
This is the
tf.sliceAPI (theSlicegenerator reading thebegin/sizeargument tensors), not the ndarray subscript-slice vocabulary (x[a:b:s]) that #406 covers viaNdarraySubscriptOperation. The two are conceptually related but live on different code paths, so they need separate trackers.Direction
In
Slice.getDefaultShapes, resolve thebeginandsizeargument points-to sets to constant integer lists (mirroring howExpandDimsresolves itsaxisConstantKeys), fetch theinput_shape via the existing arg-shape helpers, and apply the per-axis formula above. Emit ⊤ (returnnull) whenbegin/sizearen't constant or the needed input dim is unknown.Use-case anchors
crf_forward'sinputs/stateparameters (tf2_test_crf.py): sourced fromtf.slice(andtf.squeezeof a slice), currentlyfloat32/⊤; runtime shapes are(2, 2, 4)and(2, 4).crf_binary_score'sstart_tag_indices/end_tag_indices/truncated_masks:tf.sliceresults, currently ⊤int32/bool.