def main(): import problem_unittests as tests tests.test_get_init_cell(get_init_cell) tests.test_get_embed(get_embed) tests.test_build_rnn(build_rnn) tests.test_build_nn(build_nn) tests.test_get_batches(get_batches) tests.test_get_tensors(get_tensors) tests.test_pick_word(pick_word) print(get_batches([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], batch_size=3, seq_length=2))
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)
:param embed_dim: Number of embedding dimensions :return: Tuple (Logits, FinalState) """ # TODO: Implement Function embed = get_embed(input_data, vocab_size, embed_dim) outputs, final_state = build_rnn(cell, embed) logits = tf.contrib.layers.fully_connected(outputs, vocab_size, activation_fn=None) return logits, final_state """ DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE """ tests.test_build_nn(build_nn) # ### Batches # Implement `get_batches` to create batches of input and targets using `int_text`. The batches should be a Numpy array with the shape `(number of batches, 2, batch size, sequence length)`. Each batch contains two elements: # - The first element is a single batch of **input** with the shape `[batch size, sequence length]` # - The second element is a single batch of **targets** with the shape `[batch size, sequence length]` # # If you can't fill the last batch with enough data, drop the last batch. # # For exmple, `get_batches([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], 2, 3)` would return a Numpy array of the following: # ``` # [ # # First Batch # [ # # Batch of Input # [[ 1 2 3], [ 7 8 9]],