code: def get_num_actions_from_tensor_spec(
      action_spec: types.BoundedTensorSpec,
  ) -> int:
      """Validates `action_spec` and returns number of actions.
  
      `action_spec` must specify a scalar int32 or int64 with minimum zero.
  
      Args:
        action_spec: a `BoundedTensorSpec`.
  
      Returns:
        The number of actions described by `action_spec`.
  
      Raises:
        ValueError: if `action_spec` is not an bounded scalar int32 or int64 spec
          with minimum 0.
      """
      if not isinstance(action_spec, tensor_spec.BoundedTensorSpec):
          raise ValueError(
              "Action spec must be a `BoundedTensorSpec`; got {}".format(
                  type(action_spec)
              )
          )
      if action_spec.shape.rank != 0:
          raise ValueError(
              "Action spec must be a scalar; got shape{}".format(
                  action_spec.shape
              )
          )
      if action_spec.dtype not in (tf.int32, tf.int64):
          raise ValueError(
              "Action spec must be have dtype int32 or int64; got {}".format(
                  action_spec.dtype
              )
          )
      if action_spec.minimum != 0:
          raise ValueError(
              "Action spec must have minimum 0; got {}".format(
                  action_spec.minimum
              )
          )
      return action_spec.maximum + 1
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  from typing import Optional, Sequence, Text, Union
  import tensorflow
  from tf_agents.specs import bandit_spec_utils
  from tf_agents.specs import tensor_spec
  from tf_agents.trajectories import policy_step
  from tf_agents.typing import types
  from tf_agents.utils import common
label_desc: Use image node_id 1 for calling a global function with example usage: get_num_actions_from_tensor_spec(action_spec) and returns: unknown