import tensorflow as tf

import tensorflow as tf
import numpy as np


class BaseModel(object):
  """Holds code shared between all the different model variants."""

  def __init__(self, batch_size, max_sequence_len, out_vocab_size, c2v,
               dropout_keep_prob=0.0):
    self._batch_size = batch_size
    self._dropout_keep_prob = dropout_keep_prob
    self._out_vocab_size = out_vocab_size

    self.x = tf.placeholder(tf.int32, [batch_size, max_sequence_len],
                            name='x')
    self.y = tf.placeholder(tf.float32, [batch_size, out_vocab_size],
                            name='y')
    # The bidirectional rnn code requires seq_lens as int64
    self.seq_lens = tf.placeholder(tf.int64, [batch_size], name='seq_lens')
    self.example_weights = tf.placeholder(tf.float32, [batch_size],
                                          name='example_weights')

    embeddings = c2v.GetEmbeddings(self.x)
    self._inputs = [tf.squeeze(input_, [1]) for input_ in
                    tf.split(1, max_sequence_len, embeddings)]

    # Need to prepare a mask to zero out the padding symbols.

    # Make a batch_size x max_sequence_len matrix where each
    # row contains the length repeated max_sequence_len times.
