code: def _as_multi_dim(maybe_scalar):
      if maybe_scalar is None:
          shape = ()
      elif tf.is_tensor(maybe_scalar) and maybe_scalar.shape.rank > 0:
          shape = maybe_scalar
      elif np.asarray(maybe_scalar).ndim > 0:
          shape = maybe_scalar
      else:
          shape = (maybe_scalar,)
      return shape
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import pprint
  from typing import NamedTuple, Optional
  import numpy
  import tensorflow
  from tf_agents.specs import array_spec
  from tf_agents.specs import tensor_spec
  from tf_agents.typing import types
label_desc: Use image node_id 4 for calling a global function with example usage: _as_multi_dim(maybe_scalar) and returns: shape