class_docstr: An agent that mixes a set of agents with a given mixture.
  
  For every data sample, the agent updates the sub-agent that was used to make
  the action choice in that sample. For this update to happen, the mixture agent
  needs to have the information on which sub-agent is "responsible" for the
  action. This information is in a policy info field `mixture_agent_id`.
  
  Note that this agent makes use of `tf.dynamic_partition`, and thus it is not
  compatible with XLA.
class_docstr_tok: ["An","agent","that","mixes","a","set","of","agents","with","a","given","mixture",".","For","every","data","sample",",","the","agent","updates","the","sub-agent","that","was","used","to","make","the","action","choice","in","that","sample",".","For","this","update","to","happen",",","the","mixture","agent","needs","to","have","the","information","on","which","sub-agent","is","``","responsible","''","for","the","action",".","This","information","is","in","a","policy","info","field","`","mixture_agent_id","`",".","Note","that","this","agent","makes","use","of","`","tf.dynamic_partition","`",",","and","thus","it","is","not","compatible","with","XLA","."]
docstr: Initializes an instance of `MixtureAgent`.
  
  Args:
    mixture_distribution: An instance of `tfd.Categorical` distribution. This
      distribution is used to draw sub-policies by the mixture policy. The
      parameters of the distribution is trained by the mixture agent.
    agents: List of instances of TF-Agents bandit agents. These agents will be
      trained and used to select actions. The length of this list should match
      that of `mixture_weights`.
    name: The name of this instance of `MixtureAgent`.
docstr_tok: ["Initializes","an","instance","of","`","MixtureAgent","`",".","Args",":","mixture_distribution",":","An","instance","of","`","tfd.Categorical","`","distribution",".","This","distribution","is","used","to","draw","sub-policies","by","the","mixture","policy",".","The","parameters","of","the","distribution","is","trained","by","the","mixture","agent",".","agents",":","List","of","instances","of","TF-Agents","bandit","agents",".","These","agents","will","be","trained","and","used","to","select","actions",".","The","length","of","this","list","should","match","that","of","`","mixture_weights","`",".","name",":","The","name","of","this","instance","of","`","MixtureAgent","`","."]
code: def __init__(
      self,
      mixture_distribution: types.Distribution,
      agents: Sequence[tf_agent.TFAgent],
      name: Optional[Text] = None,
  ):
      """Initializes an instance of `MixtureAgent`.
  
      Args:
        mixture_distribution: An instance of `tfd.Categorical` distribution. This
          distribution is used to draw sub-policies by the mixture policy. The
          parameters of the distribution is trained by the mixture agent.
        agents: List of instances of TF-Agents bandit agents. These agents will be
          trained and used to select actions. The length of this list should match
          that of `mixture_weights`.
        name: The name of this instance of `MixtureAgent`.
      """
      tf.Module.__init__(self, name=name)
      time_step_spec = agents[0].time_step_spec
      action_spec = agents[0].action_spec
      self._original_info_spec = agents[0].policy.info_spec
      error_message = None
      for agent in agents[1:]:
          if action_spec != agent.action_spec:
              error_message = "Inconsistent action specs."
          if time_step_spec != agent.time_step_spec:
              error_message = "Inconsistent time step specs."
          if self._original_info_spec != agent.policy.info_spec:
              error_message = "Inconsistent info specs."
      if error_message is not None:
          raise ValueError(error_message)
      self._agents = agents
      self._num_agents = len(agents)
      self._mixture_distribution = mixture_distribution
      policies = [agent.collect_policy for agent in agents]
      policy = mixture_policy.MixturePolicy(
          mixture_distribution, policies
      )
      super(MixtureAgent, self).__init__(
          time_step_spec,
          action_spec,
          policy,
          policy,
          train_sequence_length=None,
      )
      self._as_trajectory = data_converter.AsTrajectory(
          self.data_context, sequence_length=None
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import abc
  from typing import List, Optional, Sequence, Text
  import gin
  import tensorflow
  from tf_agents.agents import data_converter
  from tf_agents.agents import tf_agent
  from tf_agents.bandits.policies import mixture_policy
  from tf_agents.trajectories import trajectory
  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 to create a new MixtureAgent object from inherited base classes: tf_agent with example: obj = MixtureAgent(mixture_distribution, agents, name)