tensorflow
tensorflow copied to clipboard
Inconsistencies between the implementation and documentation of tf.slice
Issue type
Bug
Have you reproduced the bug with TensorFlow Nightly?
Yes
Source
source
TensorFlow version
v2.19.0-rc0-6-ge36baa30292 2.19.0
Custom code
Yes
OS platform and distribution
Linux Ubuntu 22.04
Mobile device
No response
Python version
3.11.11
Bazel version
No response
GCC/compiler version
No response
CUDA/cuDNN version
No response
GPU model and memory
NVIDIA H100 - 80GB
Current behavior?
Like https://github.com/tensorflow/tensorflow/issues/92955, in the doc of tf.strided_slice, it shows that begin and sizes should be an int32 or int64 Tensor. While in the real implementation, int16 is also allowed in these three parameters.
Standalone code to reproduce the issue
import tensorflow as tf
a = tf.constant([[[1, 1, 1], [2, 2, 2]],
[[3, 3, 3], [4, 4, 4]],
[[5, 5, 5], [6, 6, 6]]],dtype=tf.int16)
b = tf.constant([1,0,0],dtype=tf.int16)
c = tf.constant([2,1,3],dtype=tf.int16)
e = tf.strided_slice(a,b,c)
print(e)
Relevant log output
tf.Tensor([[[3 3 3]]], shape=(1, 1, 3), dtype=int16)