code: def _validate_weights(weights: types.Tensor):
      if len(weights.shape) != 1:
          raise ValueError(
              "Expected a 1D `Tensor` of weights; got {}.".format(
                  weights
              )
          )
  
file_path: agents/tf_agents/bandits/policies/categorical_policy.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from typing import Optional, Text
  import tensorflow
  import tensorflow_probability
  from tf_agents.policies import tf_policy
  from tf_agents.trajectories import policy_step
  from tf_agents.typing import types
  from tf_agents.utils import common
  from tf_agents.utils import nest_utils
label_desc: Use image node_id 1 for calling a global function with example usage: _validate_weights(weights) without return types