code: def _maybe_static_outer_dim(t):
      """Return the left-most dense shape dimension of `t`.
  
      Args:
        t: A `Tensor` or `CompositeTensor`.
  
      Returns:
        A python integer or `0-D` scalar tensor with type `int64`.
      """
      assert tf.is_tensor(t), t
      if isinstance(t, tf.SparseTensor):
          static_shape = tf.get_static_value(t.dense_shape)
          if static_shape is not None:
              return static_shape[0]
          else:
              return t.dense_shape[0]
      elif isinstance(t, tf.RaggedTensor):
          outer_dim = tf.compat.dimension_value(t.shape[0])
          return outer_dim if outer_dim is not None else t.nrows()
      else:
          outer_dim = tf.compat.dimension_value(t.shape[0])
          return outer_dim if outer_dim is not None else tf.shape(t)[0]
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import pprint
  from typing import NamedTuple, Optional
  import numpy
  import tensorflow
  from tf_agents.trajectories import policy_step
  from tf_agents.trajectories import time_step
  from tf_agents.typing import types
  from tf_agents.utils import composite
  from tf_agents.utils import nest_utils
  from tf_agents.utils import value_ops
label_desc: Use image node_id 7 for calling a global function with example usage: _maybe_static_outer_dim(t) and returns: static_shape, t, unknown, unknown