def run_test():

    import problem_unittests as t

    t.test_create_lookup_tables(create_lookup_tables)
    t.test_get_batches(get_batches)
    t.test_tokenize(token_lookup)
    t.test_get_inputs(get_inputs)
    t.test_get_init_cell(get_init_cell)
    t.test_get_embed(get_embed)
    t.test_build_rnn(build_rnn)
    t.test_build_nn(build_nn)
    t.test_get_tensors(get_tensors)
    t.test_pick_word(pick_word)
Ejemplo n.º 2
0
    Create TF Placeholders for input, targets, and learning rate.
    :return: Tuple (input, targets, learning rate)
    """
    # TODO: Implement Function
    inputs = tf.placeholder(dtype=tf.int32, shape=[None, None], name='input')
    targets = tf.placeholder(dtype=tf.int32,
                             shape=[None, None],
                             name='targets')
    learning_rate = tf.placeholder(dtype=tf.float32, name='learning_rate')
    return inputs, targets, learning_rate


"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tests.test_get_inputs(get_inputs)

# ### Build RNN Cell and Initialize
# Stack one or more [`BasicLSTMCells`](https://www.tensorflow.org/api_docs/python/tf/contrib/rnn/BasicLSTMCell) in a [`MultiRNNCell`](https://www.tensorflow.org/api_docs/python/tf/contrib/rnn/MultiRNNCell).
# - The Rnn size should be set using `rnn_size`
# - Initalize Cell State using the MultiRNNCell's [`zero_state()`](https://www.tensorflow.org/api_docs/python/tf/contrib/rnn/MultiRNNCell#zero_state) function
#     - Apply the name "initial_state" to the initial state using [`tf.identity()`](https://www.tensorflow.org/api_docs/python/tf/identity)
#
# Return the cell and initial state in the following tuple `(Cell, InitialState)`

# In[48]:


def get_init_cell(batch_size, rnn_size):
    """
    Create an RNN Cell and initialize it.