(self, sess, data_x, data_y, len_list, verbose=10)
return np.mean(total_loss)
Runs an epoch of training.

        Trains the model for one-epoch.

        Args:
            sess: tf.Session() object
            data_x: input data, have shape of (data_num, num_steps), change it to ndarray before this function is called
            data_y: label, have shape of (data_num, class_num)
            len_list: length list correspond to data_x, have shape of (data_num)
        Returns:
            average_loss: scalar. Average minibatch loss of model on epoch.
Runs an epoch of training.
Runs an epoch of training .
def run_epoch(self, sess, data_x, data_y, len_list, verbose=10):
        """Runs an epoch of training.

        Trains the model for one-epoch.

        Args:
            sess: tf.Session() object
            data_x: input data, have shape of (data_num, num_steps), change it to ndarray before this function is called
            data_y: label, have shape of (data_num, class_num)
            len_list: length list correspond to data_x, have shape of (data_num)
        Returns:
            average_loss: scalar. Average minibatch loss of model on epoch.
        """
        data_len = len(data_x)
        total_steps =data_len // self.config.batch_size
        total_loss = []
        for step, indices in enumerate(helper.data_iter_indices(data_len, self.config.batch_size)):
            feed_dict = self.create_feed_dict(data_x[indices], len_list[indices], data_y[indices])
            _, loss, lr = sess.run([self.train_op, self.loss, self.learning_rate], feed_dict=feed_dict)
            total_loss.append(loss)
            if verbose and step % verbose == 0:
                sys.stdout.write('\r{} / {} : loss = {}, lr = {}'.format(
                    step, total_steps, np.mean(total_loss[-verbose:]), lr))
                sys.stdout.flush()
        return np.mean(total_loss)
def run_epoch ( self , sess , data_x , data_y , len_list , verbose = 10 ) : data_len = len ( data_x ) total_steps = data_len // self . config . batch_size total_loss = [ ] for step , indices in enumerate ( helper . data_iter_indices ( data_len , self . config . batch_size ) ) : feed_dict = self . create_feed_dict ( data_x [ indices ] , len_list [ indices ] , data_y [ indices ] ) _ , loss , lr = sess . run ( [ self . train_op , self . loss , self . learning_rate ] , feed_dict = feed_dict ) total_loss . append ( loss ) if verbose and step % verbose == 0 : sys . stdout . write ( '\r{} / {} : loss = {}, lr = {}' . format ( step , total_steps , np . mean ( total_loss [ - verbose : ] ) , lr ) ) sys . stdout . flush ( ) return np . mean ( total_loss )