def _train(self, training_step, snapshot_epoch, snapshot_step,
               show_metric):
        """ Training process for this optimizer.

        Arguments:
            training_step: `int`. The global step.
            snapshot_epoch: `bool`. If True, snapshot network at each epoch.
            snapshot_step: `int`. If not None, snapshot network given 'step'.
            show_metric: `bool`. If True, display accuracy at every step.

        """
        tflearn.is_training(True, self.session)
        self.loss_value, self.acc_value = None, None
        self.val_loss, self.val_acc = None, None
        train_summ_str, test_summ_str = None, None
        snapshot = False

        batch_ids = self.index_array[self.batch_start:self.batch_end]

        feed_batch = {}
        for key in self.feed_dict:
            # Make batch for multi-dimensional data
            if np.ndim(self.feed_dict[key]) > 0:
                feed_batch[key] = slice_array(self.feed_dict[key], batch_ids)
            else:
                feed_batch[key] = self.feed_dict[key]

        tflearn.is_training(True, self.session)
        self.session.run([self.train], feed_batch)

        tflearn.is_training(False, self.session)
        if self.summ_op is not None:
            train_summ_str = self.session.run(self.summ_op, feed_batch)

        # Retrieve loss value from summary string
        sname = "- Loss/" + self.scope_name
        self.loss_value = summaries.get_value_from_summary_string(
            sname, train_summ_str)

        if show_metric and self.metric is not None:
            # Retrieve accuracy value from summary string
            sname = "- " + self.metric_summ_name + "/" + self.scope_name
            self.acc_value = summaries.get_value_from_summary_string(
                sname, train_summ_str)

        # Check if data reached an epoch
        if not self.next_batch():
            if self.shuffle:
                np.random.shuffle(self.index_array)
            batches = make_batches(self.n_train_samples, self.batch_size)
            self.set_batches(batches)
            if snapshot_epoch:
                snapshot = True

        # Check if step reached snapshot step
        if snapshot_step:
            if snapshot_step % training_step == 0:
                snapshot = True

        # Calculate validation
        if snapshot and self.val_feed_dict:
            # Evaluation returns the mean over all batches.
            self.val_loss = evaluate(self.session, self.loss,
                                     self.val_feed_dict,
                                     self.batch_size)
            if show_metric and self.metric is not None:
                self.val_acc = evaluate(self.session, self.metric,
                                        self.val_feed_dict,
                                        self.batch_size)
            # Set evaluation results to variables, to be summarized.
            if show_metric:
                update_val_op = [tf.assign(self.val_loss_T, self.val_loss),
                                 tf.assign(self.val_acc_T, self.val_acc)]
            else:
                update_val_op = tf.assign(self.val_loss_T, self.val_loss)
            self.session.run(update_val_op)

            # Run summary operation.
            test_summ_str = self.session.run(self.val_summary_op,
                                             self.val_feed_dict)

        # Write to Tensorboard
        n_step = self.training_steps.eval(session=self.session)
        if n_step > 1:
            if train_summ_str:
                self.summary_writer.add_summary(
                    train_summ_str, n_step)
            if test_summ_str:
                self.summary_writer.add_summary(
                    test_summ_str, n_step)

        return snapshot
dataset/ETHPy150Open tflearn/tflearn/tflearn/helpers/trainer.py/TrainOp._train/swapped operands of `%`