def iaf_hparams(hidden_size=512, filter_size=4096):
  """Create hyperpameters for inverse autoregressive flows.

  Args:
    hidden_size: Width of attention layers and neural network output layer.
    filter_size: Hidden layer width for neural network.

  Returns:
    hparams: Hyperpameters with basic presets for inverse autoregressive flows.
  """
  hparams = common_hparams.basic_params1()

  # Attention hyperparameters.
  hparams.hidden_size = hidden_size
  hparams.add_hparam("attention_key_channels", None)
  hparams.add_hparam("attention_value_channels", None)
  hparams.add_hparam("num_heads", 4)
  hparams.add_hparam("attention_dropout", 0.1)
  hparams.add_hparam("shared_rel", False)
  hparams.add_hparam("block_width", 1)
  hparams.add_hparam("block_length", 1)
  hparams.add_hparam("q_filter_width", 1)
  hparams.add_hparam("kv_filter_width", 1)

  # Preprocessing and postprocesing hyperparameters.
  hparams.layer_preprocess_sequence = "n"
  hparams.layer_prepostprocess_dropout = 0.1
  hparams.norm_type = "layer"
  hparams.norm_epsilon = 1e-06
  hparams.layer_prepostprocess_dropout_broadcast_dims = ""
  hparams.layer_postprocess_sequence = "da"

  # Feedforward neural network hyperparameters.
  hparams.add_hparam("filter_size", filter_size)
  hparams.add_hparam("ffn_layer", "conv_hidden_relu")
  hparams.add_hparam("relu_dropout", 0.1)
  return hparams
Create hyperpameters for inverse autoregressive flows.

  Args:
    hidden_size: Width of attention layers and neural network output layer.
    filter_size: Hidden layer width for neural network.

  Returns:
    hparams: Hyperpameters with basic presets for inverse autoregressive flows.