code: def _get_shape(tensor):
      """Like get_shape().as_list(), but explicitly queries the shape of a tensor
      if necessary to ensure that the returned value contains no unknown value.
      """
  
      shape = tensor.shape.as_list()
      none_indices = [i for i, d in enumerate(shape) if d is None]
      if none_indices:
          # Query the shape if shape contains None values
          shape_tensor = array_ops.shape(tensor)
          for i in none_indices:
              shape[i] = shape_tensor[i]
      return shape
  
imports: import collections
  import functools
  import re
  import string
  import numpy
  import opt_einsum
  from tensorflow.compiler.tf2xla.ops import gen_xla_ops
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import gen_linalg_ops
  from tensorflow.python.ops import gen_special_math_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.util import deprecation
  from tensorflow.python.util import dispatch
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 27 for calling a global function with example usage: _get_shape(tensor) and returns: shape