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
tensorflow-copybara
merged 18 commits into
tensorflow:master
from
kaixih:lstmp_upstream
Jun 11, 2019
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
9ff2778
add cudnn lstm projection (lstmp)
kaixih dbe02b8
fixed some conflicts
kaixih a867a32
Merge remote-tracking branch 'google/master' into lstmp_upstream
kaixih e6904eb
removed some duplicated codes
kaixih bc10912
Use cell_ instead of c_; Add back commented-out tests
kaixih 291d39f
Added apidef files for canon <-> cudnnparams V2
kaixih f38dd43
use a tuple for batch/time_id
kaixih f4e1bc6
minor changes
kaixih f4c2a0c
change input params as const
kaixih f65f560
change CHECK to OP_REQUIRES
kaixih 6a3d554
fixed a shapeinference for cudnn rnn
kaixih f7f31ea
Format changes
kaixih 9d7c1ed
declare of input_c_shape
kaixih b64d3dd
forward compat
kaixih f3bc96b
forward compat test
kaixih ef8517b
format changes
kaixih df2b9b7
updated the goldens
kaixih c0ea11b
added two api def files and solved some python format issues
kaixih File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
416 changes: 271 additions & 145 deletions
416
tensorflow/contrib/cudnn_rnn/python/kernel_tests/cudnn_rnn_ops_test.py
Large diffs are not rendered by default.
Oops, something went wrong.
303 changes: 226 additions & 77 deletions
303
tensorflow/contrib/cudnn_rnn/python/ops/cudnn_rnn_ops.py
Large diffs are not rendered by default.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
tensorflow/core/api_def/base_api/api_def_CudnnRNNCanonicalToParamsV2.pbtxt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
36 changes: 36 additions & 0 deletions
36
tensorflow/core/api_def/base_api/api_def_CudnnRNNParamsToCanonicalV2.pbtxt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
4 changes: 4 additions & 0 deletions
4
tensorflow/core/api_def/python_api/api_def_CudnnRNNCanonicalToParamsV2.pbtxt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
op { | ||
graph_op_name: "CudnnRNNCanonicalToParamsV2" | ||
visibility: HIDDEN | ||
} |
4 changes: 4 additions & 0 deletions
4
tensorflow/core/api_def/python_api/api_def_CudnnRNNParamsToCanonicalV2.pbtxt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
op { | ||
graph_op_name: "CudnnRNNParamsToCanonicalV2" | ||
visibility: HIDDEN | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.