docstr: Args:
      input_size -- scalar; dim of inputs
      hidden_size -- scalar; dim of hidden layers
      n_hidden -- scalar; number of hidden layers
      activation -- str; activation function to use
      input_order -- str or tensor; variable order for creating the autoregressive masks (sequential|random)
                      or the order flipped from the previous layer in a stack of MADEs
      conditional -- bool; whether model is conditional
docstr_tok: ["Args",":","input_size","--","scalar",";","dim","of","inputs","hidden_size","--","scalar",";","dim","of","hidden","layers","n_hidden","--","scalar",";","number","of","hidden","layers","activation","--","str",";","activation","function","to","use","input_order","--","str","or","tensor",";","variable","order","for","creating","the","autoregressive","masks","(","sequential|random",")","or","the","order","flipped","from","the","previous","layer","in","a","stack","of","MADEs","conditional","--","bool",";","whether","model","is","conditional"]
code: def __init__(
      self,
      input_size,
      hidden_size,
      n_hidden,
      cond_label_size=None,
      activation="ReLU",
      input_order="sequential",
      input_degrees=None,
  ):
      """
      Args:
          input_size -- scalar; dim of inputs
          hidden_size -- scalar; dim of hidden layers
          n_hidden -- scalar; number of hidden layers
          activation -- str; activation function to use
          input_order -- str or tensor; variable order for creating the autoregressive masks (sequential|random)
                          or the order flipped from the previous layer in a stack of MADEs
          conditional -- bool; whether model is conditional
      """
      super().__init__()
      # base distribution for calculation of log prob under the model
      self.register_buffer("base_dist_mean", torch.zeros(input_size))
      self.register_buffer("base_dist_var", torch.ones(input_size))
  
      # create masks
      masks, self.input_degrees = create_masks(
          input_size, hidden_size, n_hidden, input_order, input_degrees
      )
  
      # setup activation
      if activation == "ReLU":
          activation_fn = nn.ReLU()
      elif activation == "Tanh":
          activation_fn = nn.Tanh()
      else:
          raise ValueError("Check activation function.")
  
      # construct model
      self.net_input = MaskedLinear(
          input_size, hidden_size, masks[0], cond_label_size
      )
      self.net = []
      for m in masks[1:-1]:
          self.net += [
              activation_fn,
              MaskedLinear(hidden_size, hidden_size, m),
          ]
      self.net += [
          activation_fn,
          MaskedLinear(
              hidden_size, 2 * input_size, masks[-1].repeat(2, 1)
          ),
      ]
      self.net = nn.Sequential(*self.net)
  
imports: import copy
  import math
  import torch
  import torch.nn
  import torch.nn.functional
  from torch.distributions import Normal
label_desc: Use image node_id 1 to create a new MADE object from inherited base classes: nn with example: obj = MADE(input_size, hidden_size, n_hidden, cond_label_size, activation, input_order, input_degrees)