docstr: Layers information
docstr_tok: ["Layers","information"]
code: def __init__(
      self, input_dim, output_dim, input_layer, s0=None, name=""
  ):
      """Layers information"""
      self.name = name
      self.input_dim = input_dim
      self.hidden_dim = output_dim
      self.output_dim = output_dim
      self.input_layer = input_layer
      self.X = input_layer.output()
      self.s0 = s0
      self.params = []
  
      """Layers weights"""
  
      """self.params is passed so that any parameters could be appended to it"""
      self.W_r = linear_transform_weights(
          input_dim,
          output_dim,
          param_list=self.params,
          name=name + ".W_r",
      )
      self.b_wr = bias_weights(
          (output_dim,), param_list=self.params, name=name + ".b_wr"
      )
  
      self.W_i = linear_transform_weights(
          input_dim,
          output_dim,
          param_list=self.params,
          name=name + ".W_i",
      )
      self.b_wi = bias_weights(
          (output_dim,), param_list=self.params, name=name + ".b_wi"
      )
  
      self.W_h = linear_transform_weights(
          input_dim,
          output_dim,
          param_list=self.params,
          name=name + ".W_h",
      )
      self.b_wh = bias_weights(
          (output_dim,), param_list=self.params, name=name + ".b_wh"
      )
  
      self.R_r = linear_transform_weights(
          output_dim,
          output_dim,
          param_list=self.params,
          name=name + ".R_r",
      )
      self.b_rr = bias_weights(
          (output_dim,), param_list=self.params, name=name + ".b_rr"
      )
  
      self.R_i = linear_transform_weights(
          output_dim,
          output_dim,
          param_list=self.params,
          name=name + ".R_i",
      )
      self.b_ru = bias_weights(
          (output_dim,), param_list=self.params, name=name + ".b_ru"
      )
  
      self.R_h = linear_transform_weights(
          output_dim,
          output_dim,
          param_list=self.params,
          name=name + ".R_h",
      )
      self.b_rh = bias_weights(
          (output_dim,), param_list=self.params, name=name + ".b_rh"
      )
  
      """step through processed input to create output"""
  
      def step(inp, s_prev):
          i_t = T.nnet.sigmoid(
              T.dot(inp, self.W_i)
              + T.dot(s_prev, self.R_i)
              + self.b_wi
              + self.b_ru
          )
          r_t = T.nnet.sigmoid(
              T.dot(inp, self.W_r)
              + T.dot(s_prev, self.R_r)
              + self.b_wr
              + self.b_rr
          )
  
          h_hat_t = T.tanh(
              T.dot(inp, self.W_h)
              + (r_t * (T.dot(s_prev, self.R_h) + self.b_rh))
              + self.b_wh
          )
  
          s_curr = ((1.0 - i_t) * h_hat_t) + (i_t * s_prev)
  
          return s_curr
  
      outputs_info = self.s0
  
      states, updates = theano.scan(
          fn=step, sequences=[self.X], outputs_info=outputs_info
      )
  
      self.Y = states
  
imports: from __future__ import absolute_import, print_function, division
  import theano
  import theano.tensor
  import numpy
label_desc: Use image node_id 1 to create a new GRU object from inherited base classes: Layer with example: obj = GRU(input_dim, output_dim, input_layer, s0, name)