Skip to content

Is input of tf.contrib.cudnn_rnn.CudnnLSTM time-major? #18318

@scotthuang1989

Description

@scotthuang1989

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow):
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): 17.10
  • TensorFlow installed from (source or binary): binary
  • TensorFlow version (use command below): 1.6
  • Python version: 3.6
  • Bazel version (if compiling from source):
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version:9/7.0
  • GPU model and memory:
  • Exact command to reproduce:

Describe the problem

I save this in tensorflow/models: quick_draw exmple

you can see that in the comment of this function. it says that CudnnLSTM is time-major, so it need a transpose. But I don't find this information in documentation here:

Where can I get confirmation of this ?

  def _add_cudnn_rnn_layers(convolved):
    """Adds CUDNN LSTM layers."""
    # Convolutions output [B, L, Ch], while CudnnLSTM is time-major.
    convolved = tf.transpose(convolved, [1, 0, 2])
    lstm = tf.contrib.cudnn_rnn.CudnnLSTM(
        num_layers=params.num_layers,
        num_units=params.num_nodes,
        dropout=params.dropout if mode == tf.estimator.ModeKeys.TRAIN else 0.0,
        direction="bidirectional")
    outputs, _ = lstm(convolved)
    # Convert back from time-major outputs to batch-major outputs.
    outputs = tf.transpose(outputs, [1, 0, 2])
    return outputs

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions