Skip to content

Commit

Permalink
Merge pull request #17970 from SamuelMarks:keras.layers.rnn-defaults-to
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 526073662
  • Loading branch information
tensorflower-gardener committed Apr 21, 2023
2 parents 5c25497 + 00a55ce commit fe2711a
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 26 deletions.
14 changes: 8 additions & 6 deletions keras/layers/rnn/base_conv_lstm.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ class ConvLSTMCell(DropoutRNNCellMixin, base_layer.BaseRandomLayer):
up/down of the input such that output has the same height/width
dimension as the input.
data_format: A string, one of `channels_last` (default) or
`channels_first`. It defaults to the `image_data_format` value found in
your Keras config file at `~/.keras/keras.json`. If you never set it,
then it will be "channels_last".
`channels_first`. When unspecified, uses
`image_data_format` value found in your Keras config file at
`~/.keras/keras.json` (if exists) else 'channels_last'.
Defaults to 'channels_last'.
dilation_rate: An integer or tuple/list of n integers, specifying the
dilation rate to use for dilated convolution. Currently, specifying any
`dilation_rate` value != 1 is incompatible with specifying any `strides`
Expand Down Expand Up @@ -383,9 +384,10 @@ class ConvLSTM(ConvRNN):
`(batch, time, ..., channels)`
while `channels_first` corresponds to
inputs with shape `(batch, time, channels, ...)`.
It defaults to the `image_data_format` value found in your
Keras config file at `~/.keras/keras.json`.
If you never set it, then it will be "channels_last".
When unspecified, uses
`image_data_format` value found in your Keras config file at
`~/.keras/keras.json` (if exists) else 'channels_last'.
Defaults to 'channels_last'.
dilation_rate: An integer or tuple/list of n integers, specifying
the dilation rate to use for dilated convolution.
Currently, specifying any `dilation_rate` value != 1 is
Expand Down
7 changes: 4 additions & 3 deletions keras/layers/rnn/conv_lstm1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ class ConvLSTM1D(ConvLSTM):
`channels_first`. The ordering of the dimensions in the inputs.
`channels_last` corresponds to inputs with shape `(batch, time, ...,
channels)` while `channels_first` corresponds to inputs with shape
`(batch, time, channels, ...)`. It defaults to the `image_data_format`
value found in your Keras config file at `~/.keras/keras.json`. If you
never set it, then it will be "channels_last".
`(batch, time, channels, ...)`. When unspecified, uses
`image_data_format` value found in your Keras config file at
`~/.keras/keras.json` (if exists) else 'channels_last'.
Defaults to 'channels_last'.
dilation_rate: An integer or tuple/list of n integers, specifying the
dilation rate to use for dilated convolution. Currently, specifying any
`dilation_rate` value != 1 is incompatible with specifying any `strides`
Expand Down
7 changes: 4 additions & 3 deletions keras/layers/rnn/conv_lstm2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ class ConvLSTM2D(ConvLSTM):
`channels_first`. The ordering of the dimensions in the inputs.
`channels_last` corresponds to inputs with shape `(batch, time, ...,
channels)` while `channels_first` corresponds to inputs with shape
`(batch, time, channels, ...)`. It defaults to the `image_data_format`
value found in your Keras config file at `~/.keras/keras.json`. If you
never set it, then it will be "channels_last".
`(batch, time, channels, ...)`. When unspecified, uses
`image_data_format` value found in your Keras config file at
`~/.keras/keras.json` (if exists) else 'channels_last'.
Defaults to 'channels_last'.
dilation_rate: An integer or tuple/list of n integers, specifying the
dilation rate to use for dilated convolution. Currently, specifying any
`dilation_rate` value != 1 is incompatible with specifying any `strides`
Expand Down
7 changes: 4 additions & 3 deletions keras/layers/rnn/conv_lstm3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ class ConvLSTM3D(ConvLSTM):
`channels_first`. The ordering of the dimensions in the inputs.
`channels_last` corresponds to inputs with shape `(batch, time, ...,
channels)` while `channels_first` corresponds to inputs with shape
`(batch, time, channels, ...)`. It defaults to the `image_data_format`
value found in your Keras config file at `~/.keras/keras.json`. If you
never set it, then it will be "channels_last".
`(batch, time, channels, ...)`. When unspecified, uses
`image_data_format` value found in your Keras config file at
`~/.keras/keras.json` (if exists) else 'channels_last'.
Defaults to 'channels_last'.
dilation_rate: An integer or tuple/list of n integers, specifying the
dilation rate to use for dilated convolution. Currently, specifying any
`dilation_rate` value != 1 is incompatible with specifying any `strides`
Expand Down
10 changes: 5 additions & 5 deletions keras/layers/rnn/gru.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,17 +507,17 @@ class GRU(DropoutRNNCellMixin, RNN, base_layer.BaseRandomLayer):
Call arguments:
inputs: A 3D tensor, with shape `[batch, timesteps, feature]`.
mask: Binary tensor of shape `[samples, timesteps]` indicating whether
a given timestep should be masked (optional, defaults to `None`).
a given timestep should be masked (optional).
An individual `True` entry indicates that the corresponding timestep
should be utilized, while a `False` entry indicates that the
corresponding timestep should be ignored.
corresponding timestep should be ignored. Defaults to `None`.
training: Python boolean indicating whether the layer should behave in
training mode or in inference mode. This argument is passed to the cell
when calling it. This is only relevant if `dropout` or
`recurrent_dropout` is used (optional, defaults to `None`).
`recurrent_dropout` is used (optional). Defaults to `None`.
initial_state: List of initial state tensors to be passed to the first
call of the cell (optional, defaults to `None` which causes creation
of zero-filled initial state tensors).
call of the cell (optional, `None` causes creation
of zero-filled initial state tensors). Defaults to `None`.
"""

def __init__(
Expand Down
3 changes: 2 additions & 1 deletion keras/layers/rnn/legacy_cells.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ def __call__(self, inputs, state, scope=None):
`2-D Tensor` with shape `[batch_size, self.state_size]`. Otherwise,
if `self.state_size` is a tuple of integers, this should be a tuple
with shapes `[batch_size, s] for s in self.state_size`.
scope: VariableScope for the created subgraph; defaults to class name.
scope: VariableScope for the created subgraph; None uses class name.
Defaults to `None`.
Returns:
A pair containing:
Expand Down
10 changes: 5 additions & 5 deletions keras/layers/rnn/lstm.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,17 +480,17 @@ class LSTM(DropoutRNNCellMixin, RNN, base_layer.BaseRandomLayer):
Call arguments:
inputs: A 3D tensor with shape `[batch, timesteps, feature]`.
mask: Binary tensor of shape `[batch, timesteps]` indicating whether
a given timestep should be masked (optional, defaults to `None`).
a given timestep should be masked (optional).
An individual `True` entry indicates that the corresponding timestep
should be utilized, while a `False` entry indicates that the
corresponding timestep should be ignored.
corresponding timestep should be ignored. Defaults to `None`.
training: Python boolean indicating whether the layer should behave in
training mode or in inference mode. This argument is passed to the cell
when calling it. This is only relevant if `dropout` or
`recurrent_dropout` is used (optional, defaults to `None`).
`recurrent_dropout` is used (optional). Defaults to `None`.
initial_state: List of initial state tensors to be passed to the first
call of the cell (optional, defaults to `None` which causes creation
of zero-filled initial state tensors).
call of the cell (optional, `None` causes creation
of zero-filled initial state tensors). Defaults to `None`.
"""

def __init__(
Expand Down

0 comments on commit fe2711a

Please sign in to comment.