code: def _convert_nest_to_shapes(x):
      """In a nest, converts raw tuples/lists of int or None to tf.TensorShape."""
      # A dict is certainly a container and not a shape. We need to handle
      # it first and not try construct a TensorShape from its keys.
      if isinstance(x, dict):
          return type(x)(
              [(k, _convert_nest_to_shapes(v)) for k, v in x.items()]
          )
      # Anything else might be already a TensorShape, a tuple that converts
      # to a TensorShape, or a sequence that needs further recursion.
      try:
          return tf.TensorShape(x)
      except TypeError:
          pass  # Will try parsing as a container instead.
      if isinstance(x, (list, tuple)):
          return type(x)([_convert_nest_to_shapes(v) for v in x])
      else:
          raise TypeError(
              "Cannot convert to nest of TensorShapes, "
              "found none of TensorShape, dict, list, tuple: %r" % x
          )
  
imports: import functools
  import json
  from absl import logging
  import tensorflow
  from tensorflow_hub import module_v2
  from tensorflow.python.framework import smart_cond
  from tensorflow.python.util import tf_inspect
label_desc: Use image node_id 1 for calling a global function with example usage: _convert_nest_to_shapes(x) and returns: type, tf, type