parameters: (self, inputs, state, scope=None)
return_statement: return m, new_state
docstring: Run one step of LSTM.
  
      Args:
        inputs: input Tensor, 2D, batch x num_units.
        state: if `state_is_tuple` is False, this must be a state Tensor,
          `2-D, batch x state_size`.  If `state_is_tuple` is True, this must be a
          tuple of state Tensors, both `2-D`, with column sizes `c_state` and
          `m_state`.
        scope: VariableScope for the created subgraph; defaults to "LSTMCell".
  
      Returns:
        A tuple containing:
        - A `2-D, [batch x output_dim]`, Tensor representing the output of the
          LSTM after reading `inputs` when previous state was `state`.
          Here output_dim is:
             num_proj if num_proj was set,
             num_units otherwise.
        - Tensor(s) representing the new state of LSTM after reading `inputs` when
          the previous state was `state`.  Same type and shape(s) as `state`.
  
      Raises:
        ValueError: If input size cannot be inferred from inputs via
          static shape inference.
docstring_summary: Run one step of LSTM.
docstring_tokens: Run one step of LSTM .
function: def __call__(self, inputs, state, scope=None):
      """Run one step of LSTM.
  
      Args:
        inputs: input Tensor, 2D, batch x num_units.
        state: if `state_is_tuple` is False, this must be a state Tensor,
          `2-D, batch x state_size`.  If `state_is_tuple` is True, this must be a
          tuple of state Tensors, both `2-D`, with column sizes `c_state` and
          `m_state`.
        scope: VariableScope for the created subgraph; defaults to "LSTMCell".
  
      Returns:
        A tuple containing:
        - A `2-D, [batch x output_dim]`, Tensor representing the output of the
          LSTM after reading `inputs` when previous state was `state`.
          Here output_dim is:
             num_proj if num_proj was set,
             num_units otherwise.
        - Tensor(s) representing the new state of LSTM after reading `inputs` when
          the previous state was `state`.  Same type and shape(s) as `state`.
  
      Raises:
        ValueError: If input size cannot be inferred from inputs via
          static shape inference.
      """
      sigmoid = math_ops.sigmoid
  
      num_proj = self._num_units if self._num_proj is None else self._num_proj
  
      if self._state_is_tuple:
        (c_prev, m_prev) = state
      else:
        c_prev = array_ops.slice(state, [0, 0], [-1, self._num_units])
        m_prev = array_ops.slice(state, [0, self._num_units], [-1, num_proj])
  
      dtype = inputs.dtype
      input_size = inputs.get_shape().with_rank(2)[1]
      if input_size.value is None:
        raise ValueError("Could not infer input size from inputs.get_shape()[-1]")
      with vs.variable_scope(scope or type(self).__name__,
                             initializer=self._initializer):  # "LSTMCell"
        concat_w = _get_concat_variable(
            "W", [input_size.value + num_proj, 3 * self._num_units],
            dtype, self._num_unit_shards)
  
        b = vs.get_variable(
            "B", shape=[3 * self._num_units],
            initializer=init_ops.zeros_initializer, dtype=dtype)
  
        # j = new_input, f = forget_gate, o = output_gate
        cell_inputs = array_ops.concat(1, [inputs, m_prev])
        lstm_matrix = nn_ops.bias_add(math_ops.matmul(cell_inputs, concat_w), b)
        j, f, o = array_ops.split(1, 3, lstm_matrix)
  
        # Diagonal connections
        if self._use_peepholes:
          w_f_diag = vs.get_variable(
              "W_F_diag", shape=[self._num_units], dtype=dtype)
          w_o_diag = vs.get_variable(
              "W_O_diag", shape=[self._num_units], dtype=dtype)
  
        if self._use_peepholes:
          f_act = sigmoid(f + self._forget_bias + w_f_diag * c_prev)
        else:
          f_act = sigmoid(f + self._forget_bias)
        c = (f_act * c_prev + (1 - f_act) * self._activation(j))
  
        if self._use_peepholes:
          m = sigmoid(o + w_o_diag * c) * self._activation(c)
        else:
          m = sigmoid(o) * self._activation(c)
  
        if self._num_proj is not None:
          concat_w_proj = _get_concat_variable(
              "W_P", [self._num_units, self._num_proj],
              dtype, self._num_proj_shards)
  
          m = math_ops.matmul(m, concat_w_proj)
          if self._proj_clip is not None:
            # pylint: disable=invalid-unary-operand-type
            m = clip_ops.clip_by_value(m, -self._proj_clip, self._proj_clip)
            # pylint: enable=invalid-unary-operand-type
  
      new_state = (rnn_cell.LSTMStateTuple(c, m) if self._state_is_tuple
                   else array_ops.concat(1, [c, m]))
      return m, new_state
function_tokens: def __call__ ( self , inputs , state , scope = None ) : sigmoid = math_ops . sigmoid num_proj = self . _num_units if self . _num_proj is None else self . _num_proj if self . _state_is_tuple : ( c_prev , m_prev ) = state else : c_prev = array_ops . slice ( state , [ 0 , 0 ] , [ - 1 , self . _num_units ] ) m_prev = array_ops . slice ( state , [ 0 , self . _num_units ] , [ - 1 , num_proj ] ) dtype = inputs . dtype input_size = inputs . get_shape ( ) . with_rank ( 2 ) [ 1 ] if input_size . value is None : raise ValueError ( "Could not infer input size from inputs.get_shape()[-1]" ) with vs . variable_scope ( scope or type ( self ) . __name__ , initializer = self . _initializer ) : # "LSTMCell" concat_w = _get_concat_variable ( "W" , [ input_size . value + num_proj , 3 * self . _num_units ] , dtype , self . _num_unit_shards ) b = vs . get_variable ( "B" , shape = [ 3 * self . _num_units ] , initializer = init_ops . zeros_initializer , dtype = dtype ) # j = new_input, f = forget_gate, o = output_gate cell_inputs = array_ops . concat ( 1 , [ inputs , m_prev ] ) lstm_matrix = nn_ops . bias_add ( math_ops . matmul ( cell_inputs , concat_w ) , b ) j , f , o = array_ops . split ( 1 , 3 , lstm_matrix ) # Diagonal connections if self . _use_peepholes : w_f_diag = vs . get_variable ( "W_F_diag" , shape = [ self . _num_units ] , dtype = dtype ) w_o_diag = vs . get_variable ( "W_O_diag" , shape = [ self . _num_units ] , dtype = dtype ) if self . _use_peepholes : f_act = sigmoid ( f + self . _forget_bias + w_f_diag * c_prev ) else : f_act = sigmoid ( f + self . _forget_bias ) c = ( f_act * c_prev + ( 1 - f_act ) * self . _activation ( j ) ) if self . _use_peepholes : m = sigmoid ( o + w_o_diag * c ) * self . _activation ( c ) else : m = sigmoid ( o ) * self . _activation ( c ) if self . _num_proj is not None : concat_w_proj = _get_concat_variable ( "W_P" , [ self . _num_units , self . _num_proj ] , dtype , self . _num_proj_shards ) m = math_ops . matmul ( m , concat_w_proj ) if self . _proj_clip is not None : # pylint: disable=invalid-unary-operand-type m = clip_ops . clip_by_value ( m , - self . _proj_clip , self . _proj_clip ) # pylint: enable=invalid-unary-operand-type new_state = ( rnn_cell . LSTMStateTuple ( c , m ) if self . _state_is_tuple else array_ops . concat ( 1 , [ c , m ] ) ) return m , new_state