class_docstr: Multi-objective MPO loss with decoupled KL constraints.
  
  This implementation of the MO-MPO loss is based on the approach proposed in
  (Abdolmaleki, Huang et al., 2020). The following features are included as
  options:
  - Satisfying the KL-constraint on a per-dimension basis (on by default)
  
  (Abdolmaleki, Huang et al., 2020): https://arxiv.org/pdf/2005.07513.pdf
class_docstr_tok: ["Multi-objective","MPO","loss","with","decoupled","KL","constraints",".","This","implementation","of","the","MO-MPO","loss","is","based","on","the","approach","proposed","in","(","Abdolmaleki",",","Huang","et","al.",",","2020",")",".","The","following","features","are","included","as","options",":","-","Satisfying","the","KL-constraint","on","a","per-dimension","basis","(","on","by","default",")","(","Abdolmaleki",",","Huang","et","al.",",","2020",")",":","https",":","\/\/arxiv.org\/pdf\/2005.07513.pdf"]
docstr: Initialize and configure the MPO loss.
  
  Args:
    epsilons: per-objective KL constraints on the non-parametric auxiliary
      policy, the one associated with the dual variables called temperature;
      expected length K.
    epsilon_mean: KL constraint on the mean of the Gaussian policy, the one
      associated with the dual variable called alpha_mean.
    epsilon_stddev: KL constraint on the stddev of the Gaussian policy, the
      one associated with the dual variable called alpha_mean.
    init_log_temperature: initial value for the temperature in log-space, note
      a softplus (rather than an exp) will be used to transform this.
    init_log_alpha_mean: initial value for the alpha_mean in log-space, note
      a softplus (rather than an exp) will be used to transform this.
    init_log_alpha_stddev: initial value for the alpha_stddev in log-space,
      note a softplus (rather than an exp) will be used to transform this.
    per_dim_constraining: whether to enforce the KL constraint on each
      dimension independently; this is the default. Otherwise the overall KL
      is constrained, which allows some dimensions to change more at the
      expense of others staying put.
    name: a name for the module, passed directly to snt.Module.
docstr_tok: ["Initialize","and","configure","the","MPO","loss",".","Args",":","epsilons",":","per-objective","KL","constraints","on","the","non-parametric","auxiliary","policy",",","the","one","associated","with","the","dual","variables","called","temperature",";","expected","length","K.","epsilon_mean",":","KL","constraint","on","the","mean","of","the","Gaussian","policy",",","the","one","associated","with","the","dual","variable","called","alpha_mean",".","epsilon_stddev",":","KL","constraint","on","the","stddev","of","the","Gaussian","policy",",","the","one","associated","with","the","dual","variable","called","alpha_mean",".","init_log_temperature",":","initial","value","for","the","temperature","in","log-space",",","note","a","softplus","(","rather","than","an","exp",")","will","be","used","to","transform","this",".","init_log_alpha_mean",":","initial","value","for","the","alpha_mean","in","log-space",",","note","a","softplus","(","rather","than","an","exp",")","will","be","used","to","transform","this",".","init_log_alpha_stddev",":","initial","value","for","the","alpha_stddev","in","log-space",",","note","a","softplus","(","rather","than","an","exp",")","will","be","used","to","transform","this",".","per_dim_constraining",":","whether","to","enforce","the","KL","constraint","on","each","dimension","independently",";","this","is","the","default",".","Otherwise","the","overall","KL","is","constrained",",","which","allows","some","dimensions","to","change","more","at","the","expense","of","others","staying","put",".","name",":","a","name","for","the","module",",","passed","directly","to","snt.Module","."]
code: def __init__(
      self,
      epsilons: Sequence[KLConstraint],
      epsilon_mean: float,
      epsilon_stddev: float,
      init_log_temperature: float,
      init_log_alpha_mean: float,
      init_log_alpha_stddev: float,
      per_dim_constraining: bool = True,
      name: str = "MOMPO",
  ):
      """Initialize and configure the MPO loss.
  
      Args:
        epsilons: per-objective KL constraints on the non-parametric auxiliary
          policy, the one associated with the dual variables called temperature;
          expected length K.
        epsilon_mean: KL constraint on the mean of the Gaussian policy, the one
          associated with the dual variable called alpha_mean.
        epsilon_stddev: KL constraint on the stddev of the Gaussian policy, the
          one associated with the dual variable called alpha_mean.
        init_log_temperature: initial value for the temperature in log-space, note
          a softplus (rather than an exp) will be used to transform this.
        init_log_alpha_mean: initial value for the alpha_mean in log-space, note
          a softplus (rather than an exp) will be used to transform this.
        init_log_alpha_stddev: initial value for the alpha_stddev in log-space,
          note a softplus (rather than an exp) will be used to transform this.
        per_dim_constraining: whether to enforce the KL constraint on each
          dimension independently; this is the default. Otherwise the overall KL
          is constrained, which allows some dimensions to change more at the
          expense of others staying put.
        name: a name for the module, passed directly to snt.Module.
  
      """
      super().__init__(name=name)
  
      # MO-MPO constraint thresholds.
      self._epsilons = tf.constant([x.value for x in epsilons])
      self._epsilon_mean = tf.constant(epsilon_mean)
      self._epsilon_stddev = tf.constant(epsilon_stddev)
  
      # Initial values for the constraints' dual variables.
      self._init_log_temperature = init_log_temperature
      self._init_log_alpha_mean = init_log_alpha_mean
      self._init_log_alpha_stddev = init_log_alpha_stddev
  
      # Whether to ensure per-dimension KL constraint satisfication.
      self._per_dim_constraining = per_dim_constraining
  
      # Remember the number of objectives
      self._num_objectives = len(epsilons)  # K = number of objectives
      self._objective_names = [x.name for x in epsilons]
  
      # Make sure there are no duplicate objective names
      if len(self._objective_names) != len(set(self._objective_names)):
          raise ValueError("Duplicate objective names are not allowed.")
  
file_path: acme/acme/tf/losses/mompo.py
imports: import dataclasses
  from typing import Dict, Sequence, Tuple, Union
  from acme.tf.losses import mpo
  import sonnet
  import tensorflow
  import tensorflow_probability
label_desc: Use image node_id 1 to create a new MultiObjectiveMPO object from inherited base classes: snt with example: obj = MultiObjectiveMPO(epsilons, epsilon_mean, epsilon_stddev, init_log_temperature, init_log_alpha_mean, init_log_alpha_stddev, per_dim_constraining, name)