<jupyter_start><jupyter_text>--- ---<jupyter_code>import collections
from tensorflow.python.ops.math_ops import tanh


class RNNCell(object):
    def __call__(self, inputs, state, scope=None):
        raise NotImplementedError("Abstract method")
    

class LSTMCell(RNNCell):
    """Basic LSTM recurrent network cell.
    The implementation is based on: http://arxiv.org/abs/1409.2329.
    We add forget_bias (default: 1) to the biases of the forget gate in order to
    reduce the scale of forgetting in the beginning of the training.
    It does not allow cell clipping, a projection layer, and does not
    use peep-hole connections: it is the basic baseline.
    For advanced models, please use the full LSTMCell that follows.
    """  
    def __init__(self, n_units, n_proj=None, forget_bias=0.0, input_size=None, activation=tanh):
        self._n_units  = n_units
        self._n_proj = n_proj
        self._forget_bias = forget_bias
        self._input_size = input_size
        self._activation = activation

        (self._state_size, 
         self._output_size) = ((LSTMStateTuple(n_units, n_proj) , n_units + n_proj)
                            if n_proj else (LSTMStateTuple(n_units, n_units), 2*n_units))

        
    @property
    def state_size(self):
        return self._state_size
    
    
    @property
    def output_size(self):
        return self. _output_size
    
    
    def __call__(self, inputs, state, scope=None):
        
        pass

# class LSTM(LSTM):
    
    
#     def __init__(self, ):
#         pass
    
_LSTMStateTuple = collections.namedtuple("LSTMStateTuple", ("c", "h"))

class LSTMStateTuple(_LSTMStateTuple):
  
    """Tuple used by LSTM Cells for `state_size`, `zero_state`, and output state.
    Stores two elements: `(c, h)`, in that order.
    Only used when `state_is_tuple=True`.
    """
    __slots__ = ()

    @property
    def dtype(self):
        (c, h) = self
        if not c.dtype == h.dtype:
            raise TypeError("Inconsistent internal state: %s vs %s" %
                            (str(c.dtype), str(h.dtype)))
    return c.dtype

x = LSTMCell(50, 20, 1.0, 128)

x.state_size
x = LSTMCell()<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup