code: def _as_shape(value):
      """Converts the argument to a TensorShape if not already one."""
      if not isinstance(value, tf.TensorShape):
          if isinstance(value, tf.Tensor):
              value = tf.get_static_value(value)
          value = tf.TensorShape(value)
      return value
  
imports: import collections
  import numpy
  import tensorflow
  from tensorflow_addons import options
  from tensorflow_addons.seq2seq import attention_wrapper
  from tensorflow_addons.seq2seq import decoder
  from tensorflow_addons.utils import keras_utils
  from tensorflow_addons.utils.resource_loader import LazySO
  from tensorflow_addons.utils.types import FloatTensorLike, TensorLike, Number
  from typeguard import typechecked
  from typing import Callable, Optional
label_desc: Use image node_id 9 for calling a global function with example usage: _as_shape(value) and returns: value