Search code examples
tensorflowgoogle-cloud-datalab

tf.nn.dynamic_rnn() returning error when used in Google Cloud Datalab


I'm trying to run an RNN on Google Cloud Datalab. The same network runs correctly on my computer, but when I run it on Datalab, I get the following error:

TypeError: dynamic_rnn() takes at least 3 arguments (3 given)

The use of dynamic_rnn() is as follows:

rnn_outputs, state = tf.nn.dynamic_rnn(cells, inputs, initial_state = initial_state_placeholder)

Is this a tensorflow version problem. On my computer I'm using tensorflow-0.9.0, from the latest GPU pip install for Ubuntu. Is Cloud Datalab perhaps using a different version, in which the use of dynamic_rnn() has changed slightly?

UPDATE: Have checked version of tensorflow imported into Datalab - it's 0.7.1. I assume there's no way of importing a newer version if this is what's causing the problem?

I'm following the directions for use here: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.dynamic_rnn.md

Many thanks.


Solution

  • dynamic_rnn does not appear to be listed in the api docs of tensorflow 0.7.

    As a next step, you could try one of the following options:

    • Deploy a newer version of Datalab. This is the recommended option. The latest version uses tensorflow 0.9.0.
    • Upgrade tensorflow to version 0.9.0 by running the command below in a Datalab notebook. See my explanation in the following stackoverflow post explaining why this is not recommended (but it may work).

    Note for tensorflow version 0.9.0 use:

    %%bash
    wget https://storage.googleapis.com/cloud-datalab/deploy/tf/tensorflow-0.9.0-cp27-none-linux_x86_64.whl && pip install --ignore-installed --no-deps tensorflow-0.9.0-cp27-none-linux_x86_64.whl && rm tensorflow-0.9.0-cp27-none-linux_x86_64.whl