parameters: (self, inputs, state)
return_statement: return m_out, state_out
docstring: Run one step of LSTM.
  
      Args:
        inputs: input Tensor, 2D, batch x num_units.
        state: state Tensor, 2D, batch x state_size.
  
      Returns:
        A tuple containing:
        - A 2D, batch x output_dim, Tensor representing the output of the LSTM
          after reading "inputs" when previous state was "state".
          Here output_dim is num_units.
        - A 2D, batch x state_size, Tensor representing the new state of LSTM
          after reading "inputs" when previous state was "state".
      Raises:
        ValueError: if an input_size was specified and the provided inputs have
          a different dimension.
docstring_summary: Run one step of LSTM.
docstring_tokens: Run one step of LSTM .
function: def call(self, inputs, state):
      """Run one step of LSTM.
  
      Args:
        inputs: input Tensor, 2D, batch x num_units.
        state: state Tensor, 2D, batch x state_size.
  
      Returns:
        A tuple containing:
        - A 2D, batch x output_dim, Tensor representing the output of the LSTM
          after reading "inputs" when previous state was "state".
          Here output_dim is num_units.
        - A 2D, batch x state_size, Tensor representing the new state of LSTM
          after reading "inputs" when previous state was "state".
      Raises:
        ValueError: if an input_size was specified and the provided inputs have
          a different dimension.
      """
      sigmoid = math_ops.sigmoid
      tanh = math_ops.tanh
  
      freq_inputs = self._make_tf_features(inputs)
      dtype = inputs.dtype
      actual_input_size = freq_inputs[0].get_shape().as_list()[1]
  
      concat_w = _get_concat_variable(
          "W", [actual_input_size + 2 * self._num_units, 4 * self._num_units],
          dtype, self._num_unit_shards)
  
      b = vs.get_variable(
          "B",
          shape=[4 * self._num_units],
          initializer=init_ops.zeros_initializer(),
          dtype=dtype)
  
      # Diagonal connections
      if self._use_peepholes:
        w_f_diag = vs.get_variable(
            "W_F_diag", shape=[self._num_units], dtype=dtype)
        w_i_diag = vs.get_variable(
            "W_I_diag", shape=[self._num_units], dtype=dtype)
        w_o_diag = vs.get_variable(
            "W_O_diag", shape=[self._num_units], dtype=dtype)
  
      # initialize the first freq state to be zero
      m_prev_freq = array_ops.zeros(
          [inputs.shape.dims[0].value or inputs.get_shape()[0], self._num_units],
          dtype)
      for fq in range(len(freq_inputs)):
        c_prev = array_ops.slice(state, [0, 2 * fq * self._num_units],
                                 [-1, self._num_units])
        m_prev = array_ops.slice(state, [0, (2 * fq + 1) * self._num_units],
                                 [-1, self._num_units])
        # i = input_gate, j = new_input, f = forget_gate, o = output_gate
        cell_inputs = array_ops.concat([freq_inputs[fq], m_prev, m_prev_freq], 1)
        lstm_matrix = nn_ops.bias_add(math_ops.matmul(cell_inputs, concat_w), b)
        i, j, f, o = array_ops.split(
            value=lstm_matrix, num_or_size_splits=4, axis=1)
  
        if self._use_peepholes:
          c = (
              sigmoid(f + self._forget_bias + w_f_diag * c_prev) * c_prev +
              sigmoid(i + w_i_diag * c_prev) * tanh(j))
        else:
          c = (sigmoid(f + self._forget_bias) * c_prev + sigmoid(i) * tanh(j))
  
        if self._cell_clip is not None:
          # pylint: disable=invalid-unary-operand-type
          c = clip_ops.clip_by_value(c, -self._cell_clip, self._cell_clip)
          # pylint: enable=invalid-unary-operand-type
  
        if self._use_peepholes:
          m = sigmoid(o + w_o_diag * c) * tanh(c)
        else:
          m = sigmoid(o) * tanh(c)
        m_prev_freq = m
        if fq == 0:
          state_out = array_ops.concat([c, m], 1)
          m_out = m
        else:
          state_out = array_ops.concat([state_out, c, m], 1)
          m_out = array_ops.concat([m_out, m], 1)
      return m_out, state_out
function_tokens: def call ( self , inputs , state ) : sigmoid = math_ops . sigmoid tanh = math_ops . tanh freq_inputs = self . _make_tf_features ( inputs ) dtype = inputs . dtype actual_input_size = freq_inputs [ 0 ] . get_shape ( ) . as_list ( ) [ 1 ] concat_w = _get_concat_variable ( "W" , [ actual_input_size + 2 * self . _num_units , 4 * self . _num_units ] , dtype , self . _num_unit_shards ) b = vs . get_variable ( "B" , shape = [ 4 * self . _num_units ] , initializer = init_ops . zeros_initializer ( ) , dtype = dtype ) # Diagonal connections if self . _use_peepholes : w_f_diag = vs . get_variable ( "W_F_diag" , shape = [ self . _num_units ] , dtype = dtype ) w_i_diag = vs . get_variable ( "W_I_diag" , shape = [ self . _num_units ] , dtype = dtype ) w_o_diag = vs . get_variable ( "W_O_diag" , shape = [ self . _num_units ] , dtype = dtype ) # initialize the first freq state to be zero m_prev_freq = array_ops . zeros ( [ inputs . shape . dims [ 0 ] . value or inputs . get_shape ( ) [ 0 ] , self . _num_units ] , dtype ) for fq in range ( len ( freq_inputs ) ) : c_prev = array_ops . slice ( state , [ 0 , 2 * fq * self . _num_units ] , [ - 1 , self . _num_units ] ) m_prev = array_ops . slice ( state , [ 0 , ( 2 * fq + 1 ) * self . _num_units ] , [ - 1 , self . _num_units ] ) # i = input_gate, j = new_input, f = forget_gate, o = output_gate cell_inputs = array_ops . concat ( [ freq_inputs [ fq ] , m_prev , m_prev_freq ] , 1 ) lstm_matrix = nn_ops . bias_add ( math_ops . matmul ( cell_inputs , concat_w ) , b ) i , j , f , o = array_ops . split ( value = lstm_matrix , num_or_size_splits = 4 , axis = 1 ) if self . _use_peepholes : c = ( sigmoid ( f + self . _forget_bias + w_f_diag * c_prev ) * c_prev + sigmoid ( i + w_i_diag * c_prev ) * tanh ( j ) ) else : c = ( sigmoid ( f + self . _forget_bias ) * c_prev + sigmoid ( i ) * tanh ( j ) ) if self . _cell_clip is not None : # pylint: disable=invalid-unary-operand-type c = clip_ops . clip_by_value ( c , - self . _cell_clip , self . _cell_clip ) # pylint: enable=invalid-unary-operand-type if self . _use_peepholes : m = sigmoid ( o + w_o_diag * c ) * tanh ( c ) else : m = sigmoid ( o ) * tanh ( c ) m_prev_freq = m if fq == 0 : state_out = array_ops . concat ( [ c , m ] , 1 ) m_out = m else : state_out = array_ops . concat ( [ state_out , c , m ] , 1 ) m_out = array_ops . concat ( [ m_out , m ] , 1 ) return m_out , state_out