class_docstr: Utility to convert numpy basic slices into TF scatter_nd indices.
code: def __init__(self, tensor):
      self.rank = tensorshape_util.rank(tensor.shape)
      if self.rank is None:
          raise ValueError(
              "_Slice2Idx: dynamic tensor ranks not supported yet."
          )
      shape = tf.shape(tensor)
      self.ranges = [
          tf.range(shape[d], dtype=tf.int32) for d in range(self.rank)
      ]
  
imports: import tensorflow.compat.v2
  from tensorflow_probability.python.internal import tensorshape_util
label_desc: Use image node_id 1 to create a new _Slice2Idx object  with example: obj = _Slice2Idx(tensor)