code: def testComputedShape(self):
      # NOTE(mrry): We cannot currently handle partially-known values,
      # because `tf.slice()` uses -1 to specify a wildcard size, and
      # this can't be handled using the
      # `tensor_util.constant_value_as_shape()` trick.
      a = constant_op.constant([[1, 2, 3], [4, 5, 6]])
      begin = constant_op.constant(0)
      size = constant_op.constant(1)
      b = array_ops.slice(a, [begin, 0], [size, 2])
      self.assertEqual([1, 2], b.get_shape())
  
      # placeholders only make sense in a graph.
      with ops.Graph().as_default():
          a = constant_op.constant([[1, 2, 3], [4, 5, 6]])
          begin = array_ops.placeholder(dtypes.int32, shape=())
          c = array_ops.slice(a, [begin, 0], [-1, 2])
          self.assertEqual([None, 2], c.get_shape().as_list())
  
imports: import numpy
  from tensorflow.python.eager import backprop
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors_impl
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gradients_impl
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 26 for calling the SliceTest obj's underlying member method code with example usage: obj.testComputedShape() without return types