Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CuDNN LSTM Projection (LSTMP) #27756

Merged
merged 18 commits into from Jun 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
416 changes: 271 additions & 145 deletions tensorflow/contrib/cudnn_rnn/python/kernel_tests/cudnn_rnn_ops_test.py

Large diffs are not rendered by default.

303 changes: 226 additions & 77 deletions tensorflow/contrib/cudnn_rnn/python/ops/cudnn_rnn_ops.py

Large diffs are not rendered by default.

@@ -0,0 +1,36 @@
op {
graph_op_name: "CudnnRNNCanonicalToParamsV2"
summary: "Converts CudnnRNN params from canonical form to usable form. It supports the projection in LSTM."
description: <<END
Writes a set of weights into the opaque params buffer so they can be used in
upcoming training or inferences.

Note that the params buffer may not be compatible across different GPUs. So any
save and restoration should be converted to and from the canonical weights and
biases.

num_layers: Specifies the number of layers in the RNN model.
num_units: Specifies the size of the hidden state.
input_size: Specifies the size of the input state.
weights: the canonical form of weights that can be used for saving
and restoration. They are more likely to be compatible across different
generations.
biases: the canonical form of biases that can be used for saving
and restoration. They are more likely to be compatible across different
generations.
num_params_weigths: number of weight parameter matrix for all layers.
num_params_biases: number of bias parameter vector for all layers.
rnn_mode: Indicates the type of the RNN model.
input_mode: Indicate whether there is a linear projection between the input and
The actual computation before the first layer. 'skip_input' is only allowed
when input_size == num_units; 'auto_select' implies 'skip_input' when
input_size == num_units; otherwise, it implies 'linear_input'.
direction: Indicates whether a bidirectional model will be used.
dir = (direction == bidirectional) ? 2 : 1
dropout: dropout probability. When set to 0., dropout is disabled.
seed: the 1st part of a seed to initialize dropout.
seed2: the 2nd part of a seed to initialize dropout.
num_proj: The output dimensionality for the projection matrices. If None or 0,
no projection is performed.
END
}
@@ -0,0 +1,36 @@
op {
graph_op_name: "CudnnRNNParamsToCanonicalV2"
summary: "Retrieves CudnnRNN params in canonical form. It supports the projection in LSTM."
description: <<END
Retrieves a set of weights from the opaque params buffer that can be saved and
restored in a way compatible with future runs.

Note that the params buffer may not be compatible across different GPUs. So any
save and restoration should be converted to and from the canonical weights and
biases.

num_layers: Specifies the number of layers in the RNN model.
num_units: Specifies the size of the hidden state.
input_size: Specifies the size of the input state.
num_params_weigths: number of weight parameter matrix for all layers.
num_params_biases: number of bias parameter vector for all layers.
weights: the canonical form of weights that can be used for saving
and restoration. They are more likely to be compatible across different
generations.
biases: the canonical form of biases that can be used for saving
and restoration. They are more likely to be compatible across different
generations.
rnn_mode: Indicates the type of the RNN model.
input_mode: Indicate whether there is a linear projection between the input and
The actual computation before the first layer. 'skip_input' is only allowed
when input_size == num_units; 'auto_select' implies 'skip_input' when
input_size == num_units; otherwise, it implies 'linear_input'.
direction: Indicates whether a bidirectional model will be used.
dir = (direction == bidirectional) ? 2 : 1
dropout: dropout probability. When set to 0., dropout is disabled.
seed: the 1st part of a seed to initialize dropout.
seed2: the 2nd part of a seed to initialize dropout.
num_proj: The output dimensionality for the projection matrices. If None or 0,
no projection is performed.
END
}
@@ -0,0 +1,4 @@
op {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tensorflow/core/api_def/api_test.cc:216
Value of: api_defs_map_.find(op.name()) != api_defs_map_.end()
Actual: false
Expected: true
CudnnRNNCanonicalToParamsV2 op does not have api_def_*.pbtxt file. Please add api_def_CudnnRNNCanonicalToParamsV2.pbtxt file under tensorflow/core/api_def/base_api/ directory.

graph_op_name: "CudnnRNNCanonicalToParamsV2"
visibility: HIDDEN
}
@@ -0,0 +1,4 @@
op {
graph_op_name: "CudnnRNNParamsToCanonicalV2"
visibility: HIDDEN
}