Initialize the parameters for an LSTM cell. Args: num_units: int, The number of units in the LSTM cell. use_peepholes: bool, set True to enable diagonal/peephole connections. cell_clip: (optional) A float value, if provided the cell state is clipped by this value prior
(self,
num_units,
use_peepholes=False,
cell_clip=None,
initializer=None,
num_proj=None,
proj_clip=None,
num_unit_shards=None,
num_proj_shards=None,
forget_bias=1.0,
state_is_tuple=True,
activation=None,
reuse=None,
name=None,
dtype=None,
**kwargs)
| 831 | @deprecated(None, "This class is equivalent as tf.keras.layers.LSTMCell," |
| 832 | " and will be replaced by that in Tensorflow 2.0.") |
| 833 | def __init__(self, |
| 834 | num_units, |
| 835 | use_peepholes=False, |
| 836 | cell_clip=None, |
| 837 | initializer=None, |
| 838 | num_proj=None, |
| 839 | proj_clip=None, |
| 840 | num_unit_shards=None, |
| 841 | num_proj_shards=None, |
| 842 | forget_bias=1.0, |
| 843 | state_is_tuple=True, |
| 844 | activation=None, |
| 845 | reuse=None, |
| 846 | name=None, |
| 847 | dtype=None, |
| 848 | **kwargs): |
| 849 | """Initialize the parameters for an LSTM cell. |
| 850 | |
| 851 | Args: |
| 852 | num_units: int, The number of units in the LSTM cell. |
| 853 | use_peepholes: bool, set True to enable diagonal/peephole connections. |
| 854 | cell_clip: (optional) A float value, if provided the cell state is clipped |
| 855 | by this value prior to the cell output activation. |
| 856 | initializer: (optional) The initializer to use for the weight and |
| 857 | projection matrices. |
| 858 | num_proj: (optional) int, The output dimensionality for the projection |
| 859 | matrices. If None, no projection is performed. |
| 860 | proj_clip: (optional) A float value. If `num_proj > 0` and `proj_clip` is |
| 861 | provided, then the projected values are clipped elementwise to within |
| 862 | `[-proj_clip, proj_clip]`. |
| 863 | num_unit_shards: Deprecated, will be removed by Jan. 2017. Use a |
| 864 | variable_scope partitioner instead. |
| 865 | num_proj_shards: Deprecated, will be removed by Jan. 2017. Use a |
| 866 | variable_scope partitioner instead. |
| 867 | forget_bias: Biases of the forget gate are initialized by default to 1 in |
| 868 | order to reduce the scale of forgetting at the beginning of the |
| 869 | training. Must set it manually to `0.0` when restoring from CudnnLSTM |
| 870 | trained checkpoints. |
| 871 | state_is_tuple: If True, accepted and returned states are 2-tuples of the |
| 872 | `c_state` and `m_state`. If False, they are concatenated along the |
| 873 | column axis. This latter behavior will soon be deprecated. |
| 874 | activation: Activation function of the inner states. Default: `tanh`. It |
| 875 | could also be string that is within Keras activation function names. |
| 876 | reuse: (optional) Python boolean describing whether to reuse variables in |
| 877 | an existing scope. If not `True`, and the existing scope already has |
| 878 | the given variables, an error is raised. |
| 879 | name: String, the name of the layer. Layers with the same name will share |
| 880 | weights, but to avoid mistakes we require reuse=True in such cases. |
| 881 | dtype: Default dtype of the layer (default of `None` means use the type of |
| 882 | the first input). Required when `build` is called before `call`. |
| 883 | **kwargs: Dict, keyword named properties for common layer attributes, like |
| 884 | `trainable` etc when constructing the cell from configs of get_config(). |
| 885 | When restoring from CudnnLSTM-trained checkpoints, use |
| 886 | `CudnnCompatibleLSTMCell` instead. |
| 887 | """ |
| 888 | super(LSTMCell, self).__init__( |
| 889 | _reuse=reuse, name=name, dtype=dtype, **kwargs) |
| 890 | _check_supported_dtypes(self.dtype) |
nothing calls this directly
no test coverage detected