docstr: Layers information
docstr_tok: ["Layers","information"]
code: def __init__(
      self,
      input_dim,
      output_dim,
      input_layer,
      s0=None,
      c0=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.c0 = c0
      self.params = []
  
      """Layers weights"""
  
      """self.params is passed so that any parameters could be appended to it"""
      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_f = linear_transform_weights(
          input_dim,
          output_dim,
          param_list=self.params,
          name=name + ".W_f",
      )
      self.b_wf = bias_weights(
          (output_dim,), param_list=self.params, name=name + ".b_wf"
      )
  
      self.W_c = linear_transform_weights(
          input_dim,
          output_dim,
          param_list=self.params,
          name=name + ".W_c",
      )
      self.b_wc = bias_weights(
          (output_dim,), param_list=self.params, name=name + ".b_wc"
      )
  
      self.W_o = linear_transform_weights(
          input_dim,
          output_dim,
          param_list=self.params,
          name=name + ".W_o",
      )
      self.b_wo = bias_weights(
          (output_dim,), param_list=self.params, name=name + ".b_wo"
      )
  
      self.R_i = linear_transform_weights(
          output_dim,
          output_dim,
          param_list=self.params,
          name=name + ".R_i",
      )
      self.b_ri = bias_weights(
          (output_dim,), param_list=self.params, name=name + ".b_ri"
      )
  
      self.R_f = linear_transform_weights(
          output_dim,
          output_dim,
          param_list=self.params,
          name=name + ".R_f",
      )
      self.b_rf = bias_weights(
          (output_dim,), param_list=self.params, name=name + ".b_rf"
      )
  
      self.R_c = linear_transform_weights(
          output_dim,
          output_dim,
          param_list=self.params,
          name=name + ".R_c",
      )
      self.b_rc = bias_weights(
          (output_dim,), param_list=self.params, name=name + ".b_rc"
      )
  
      self.R_o = linear_transform_weights(
          output_dim,
          output_dim,
          param_list=self.params,
          name=name + ".R_o",
      )
      self.b_ro = bias_weights(
          (output_dim,), param_list=self.params, name=name + ".b_ro"
      )
  
      """step through processed input to create output"""
  
      def step(x_t, h_tm1, c_tm1):
          i_t = T.nnet.sigmoid(
              T.dot(x_t, self.W_i)
              + T.dot(h_tm1, self.R_i)
              + self.b_wi
              + self.b_ri
          )
          f_t = T.nnet.sigmoid(
              T.dot(x_t, self.W_f)
              + T.dot(h_tm1, self.R_f)
              + self.b_wf
              + self.b_rf
          )
          o_t = T.nnet.sigmoid(
              T.dot(x_t, self.W_o)
              + T.dot(h_tm1, self.R_o)
              + self.b_ro
              + self.b_wo
          )
  
          c_hat_t = T.tanh(
              T.dot(x_t, self.W_c)
              + T.dot(h_tm1, self.R_c)
              + self.b_wc
              + self.b_rc
          )
          c_t = f_t * c_tm1 + i_t * c_hat_t
          h_t = o_t * T.tanh(c_t)
  
          return h_t, c_t
  
      outputs_info = [self.s0, self.c0]
  
      states, updates = theano.scan(
          fn=step, sequences=[self.X], outputs_info=outputs_info
      )
  
      self.Y = states[0]
      self.C = states[1]
  
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 LSTM object from inherited base classes: Layer with example: obj = LSTM(input_dim, output_dim, input_layer, s0, c0, name)