import tensorflow as tf

        data: Data_loader object to interact with dataset.
        config: Config object to store data related to training, testing and validation.
        logger: Logger object to use tensorboard.
    """

    def __init__(self, sess, model, data, config, logger):
        self.model = model
        self.config = config
        self.sess = sess
        self.data = data
        self.logger = logger
        if not self.config.pretrain:  # If not pretrain then initialize variables.
            self.init = tf.group(tf.global_variables_initializer(), tf.local_variables_initializer())
            self.sess.run(self.init)

    def train(self):
        """Train the model for the number of epochs in config.num_epochs.
        Calls validate_epoch if config.use_val is set to true and per config.val_per_epoch.
        Returns:

        """
        for cur_epoch in range(self.model.cur_epoch_tensor.eval(self.sess), self.config.num_epochs + 1, 1):
            self.data.prepare_new_epoch_data()
            self.train_epoch()
