# Path: chatbot/components/bot_ops.py
# def dynamic_sampled_softmax_loss(labels, logits, output_projection, vocab_size,
#                                  from_scratch=False, num_samples=512, name=None):
# def _dynamic_sampled_map(labels, logits, output_projection, vocab_size,
#                                  num_samples=512, name=None):
#         def sampled_loss(elem):
# def _dynamic_sampled_from_scratch(labels, logits, output_projection, vocab_size,
#                                   num_samples, name=None):
#         def sampled_loss_single_timestep(args):
#                 def fn(s_i): return tf.where(targets == s_i, tf.ones_like(targets), tf.zeros_like(targets))
# def cross_entropy_sequence_loss(logits, labels, weights):
# def dot_prod(x, y):
# def bahdanau_score(attention_dim, h_j, s_i):
# def luong_score(attention_dim, h_j, s_i):
# def linear_map(args, output_size, biases=None):
#                 _W = tf.nn.embedding_lookup(weights, all_ids, partition_strategy='div')
#                 W = {'targets': tf.slice(_W, begin=[0, 0], size=[batch_size, state_size]),
#                      'samples': tf.slice(_W, begin=[batch_size, 0], size=[num_samples, state_size])}
#                 F = tf.concat([true_logits, sampled_logits], 1)


import tensorflow as tf
from tensorflow.python.util import nest
from tensorflow.python.ops import rnn_cell_impl
from chatbot.components import bot_ops
from tensorflow.contrib.rnn import RNNCell
from tensorflow.contrib.rnn import GRUCell, MultiRNNCell, LSTMStateTuple
from tensorflow.python.layers import core as layers_core
    from tensorflow.contrib.seq2seq import DynamicAttentionWrapper \
        as AttentionWrapper
    from tensorflow.contrib.seq2seq import DynamicAttentionWrapperState \
        as AttentionWrapperState
    from tensorflow.contrib.seq2seq import AttentionWrapper
    from tensorflow.contrib.seq2seq import AttentionWrapperState
"""Collection of base RNN classes and custom RNNCells.
"""


# Required due to TensorFlow's unreliable naming across versions . . .
try:
    # r1.1
except ImportError:
    # master


class Cell(RNNCell):
    """Simple wrapper class for any extensions I want to make to the
    encoder/decoder rnn cells. For now, just Dropout+GRU."""


# Path: chatbot/components/bot_ops.py
# def dynamic_sampled_softmax_loss(labels, logits, output_projection, vocab_size,
#                                  from_scratch=False, num_samples=512, name=None):
# def _dynamic_sampled_map(labels, logits, output_projection, vocab_size,
#                                  num_samples=512, name=None):
#         def sampled_loss(elem):
# def _dynamic_sampled_from_scratch(labels, logits, output_projection, vocab_size,
#                                   num_samples, name=None):
#         def sampled_loss_single_timestep(args):
#                 def fn(s_i): return tf.where(targets == s_i, tf.ones_like(targets), tf.zeros_like(targets))
# def cross_entropy_sequence_loss(logits, labels, weights):
# def dot_prod(x, y):
# def bahdanau_score(attention_dim, h_j, s_i):
# def luong_score(attention_dim, h_j, s_i):
# def linear_map(args, output_size, biases=None):
#                 _W = tf.nn.embedding_lookup(weights, all_ids, partition_strategy='div')
#                 W = {'targets': tf.slice(_W, begin=[0, 0], size=[batch_size, state_size]),
#                      'samples': tf.slice(_W, begin=[batch_size, 0], size=[num_samples, state_size])}
#                 F = tf.concat([true_logits, sampled_logits], 1)


# Path: chatbot/components/base/_rnn.py
import tensorflow as tf
from tensorflow.python.util import nest
from tensorflow.python.ops import rnn_cell_impl
from chatbot.components import bot_ops
from tensorflow.contrib.rnn import RNNCell
from tensorflow.contrib.rnn import GRUCell, MultiRNNCell, LSTMStateTuple
from tensorflow.python.layers import core as layers_core
    from tensorflow.contrib.seq2seq import DynamicAttentionWrapper \
        as AttentionWrapper
    from tensorflow.contrib.seq2seq import DynamicAttentionWrapperState \
        as AttentionWrapperState
    from tensorflow.contrib.seq2seq import AttentionWrapper
    from tensorflow.contrib.seq2seq import AttentionWrapperState

"""Collection of base RNN classes and custom RNNCells.
"""


# Required due to TensorFlow's unreliable naming across versions . . .
try:
    # r1.1
except ImportError:
    # master


class Cell(RNNCell):
    """Simple wrapper class for any extensions I want to make to the
    encoder/decoder rnn cells. For now, just Dropout+GRU."""


    def __init__(self, state_size, num_layers, dropout_prob, base_cell):