import tensorflow as tf

            # print(pred_strings)
            # print(self.labels)

            loss = self.loss_layer(logits, true_tag_ids, nwords, crf_params)

            metrics = self.compute_metrics(
                true_tag_ids, pred_ids, num_tags, indices, nwords
            )

            if self.mode == tf.estimator.ModeKeys.EVAL:

                return tf.estimator.EstimatorSpec(
                    self.mode, loss=loss, eval_metric_ops=metrics
                )

            elif self.mode == tf.estimator.ModeKeys.TRAIN:

                optimizer_params = self.params.get("optimizer_params", {})
                global_step = tf.train.get_or_create_global_step()

                # apply learning rate decay if it's setup already.
                lr_decay_params = optimizer_params.pop("learning_rate_exp_decay", {})
