code: def shapes_are_compatible(
      shapes0: type_utils.TreeDict[type_utils.Shape],
      shapes1: type_utils.TreeDict[type_utils.Shape],
  ) -> bool:
      """Returns True if all shapes are compatible."""
      # Use `py_utils.map_nested` instead of `tree_utils.map_structure` as shapes
      # are tuple/list.
      shapes0 = py_utils.map_nested(
          tf.TensorShape, shapes0, dict_only=True
      )
      shapes1 = py_utils.map_nested(
          tf.TensorShape, shapes1, dict_only=True
      )
      all_values = tree_utils.map_structure(
          lambda s0, s1: s0.is_compatible_with(s1),
          shapes0,
          shapes1,
      )
      return all(tf.nest.flatten(all_values))
  
imports: from __future__ import annotations
  import collections
  import contextlib
  from typing import Any, Union
  import numpy
  from tensorflow_datasets.core.utils import py_utils
  from tensorflow_datasets.core.utils import tree_utils
  from tensorflow_datasets.core.utils import type_utils
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
label_desc: Use image node_id 4 for calling a global function with example usage: shapes_are_compatible(shapes0, shapes1) and returns: all