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: Creates the dual variables the first time the loss module is called.
docstr_tok: ["Creates","the","dual","variables","the","first","time","the","loss","module","is","called","."]
code: def create_dual_variables_once(
      self, shape: tf.TensorShape, dtype: tf.DType
  ):
      """Creates the dual variables the first time the loss module is called."""
  
      # Create the dual variables.
      self._log_temperature = tf.Variable(
          initial_value=[self._init_log_temperature]
          * self._num_objectives,
          dtype=dtype,
          name="log_temperature",
          shape=(self._num_objectives,),
      )
      self._log_alpha_mean = tf.Variable(
          initial_value=tf.fill(shape, self._init_log_alpha_mean),
          dtype=dtype,
          name="log_alpha_mean",
          shape=shape,
      )
      self._log_alpha_stddev = tf.Variable(
          initial_value=tf.fill(shape, self._init_log_alpha_stddev),
          dtype=dtype,
          name="log_alpha_stddev",
          shape=shape,
      )
  
      # Cast constraint thresholds to the expected dtype.
      self._epsilons = tf.cast(self._epsilons, dtype)
      self._epsilon_mean = tf.cast(self._epsilon_mean, dtype)
      self._epsilon_stddev = tf.cast(self._epsilon_stddev, dtype)
  
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 3 for calling the MultiObjectiveMPO obj's underlying member method code with example usage: obj.create_dual_variables_once(shape, dtype) without return types