code: def _check_ndims(t):
      if t.shape.ndims is None:
          raise ValueError(
              "Expected tensor (%s) to have known rank, but ndims == None."
              % t
          )
  
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 6 for calling a global function with example usage: _check_ndims(t) without return types