def model_eval(self, data_loader, epoch, phase='test'):
    loss_hypo_vlue = np.zeros(self.num_tsk)
    correct_hypo = np.zeros(self.num_tsk)
    self.FE.eval()
    for t in range(self.num_tsk):
        n_batch_t = 0
        self.hypothesis[t].eval()
        for j in range((t + 1), self.num_tsk):
            self.discrm['{}{}'.format(t, j)].eval()
        for (inputs, targets) in data_loader[t]:
            n_batch_t += 1
            inputs = inputs.to(self.device)
            targets = targets.to(self.device)
            features = self.FE(inputs)
            features = features.view(features.size(0), (- 1))
            label_prob = self.hypothesis[t](features)
            pred = label_prob.argmax(dim=1, keepdim=True)
            correct_hypo[t] += (pred.eq(targets.view_as(pred)).sum().item() / len(pred))
            loss_hypo_vlue[t] += F.cross_entropy(label_prob, targets, reduction='mean').item()
            if ((n_batch_t % 100) == 0):
                grid_img = torchvision.utils.make_grid(inputs, nrow=5, padding=30)
                self.writer.add_image(('result Image_' + phase), grid_img)
        loss_hypo_vlue[t] /= n_batch_t
        correct_hypo[t] /= n_batch_t
        self.writer.add_scalars((('task_' + str(t)) + '/loss'), {('loss_' + phase): loss_hypo_vlue[t]}, epoch)
        self.writer.add_scalars((('task_' + str(t)) + '/Acc'), {('Acc_' + phase): correct_hypo[t]}, epoch)
    print(((('\t === hypothesiz **' + phase) + '** loss \n') + str(loss_hypo_vlue)))
    print(((('\t === hypothesiz **' + phase) + '** accuracy \n') + str((correct_hypo * 100))))
    return correct_hypo
def model_eval(self, data_loader, epoch, phase='test'):
    loss_hypo_vlue = np.zeros(self.num_tsk)
    correct_hypo = np.zeros(self.num_tsk)
    self.FE.eval()
    for t in range(self.num_tsk):
        n_batch_t = 0
        self.hypothesis[t].eval()
        for j in range((t + 1), self.num_tsk):
            self.discrm['{}{}'.format(t, j)].eval()
        for (inputs, targets) in data_loader[t]:
            n_batch_t += 1
            inputs = inputs.to(self.device)
            targets = targets.to(self.device)
            features = self.FE(inputs)
            features = features.view(features.size(0), (- 1))
            label_prob = self.hypothesis[t](features)
            pred = label_prob.argmax(dim=1, keepdim=True)
            correct_hypo[t] += (pred.eq(targets.view_as(pred)).sum().item() / len(pred))
            loss_hypo_vlue[t] += F.cross_entropy(label_prob, targets, reduction='mean').item()
            if ((n_batch_t % 100) == 0):
                grid_img = torchvision.utils.make_grid(inputs, nrow=5, padding=30)
                self.writer.add_image(('result Image_' + phase), grid_img)
        loss_hypo_vlue[t] /= n_batch_t
        correct_hypo[t] /= n_batch_t
        self.writer.add_scalars((('task_' + str(t)) + '/loss'), {('loss_' + phase): loss_hypo_vlue[t]}, epoch)
        self.writer.add_scalars((('task_' + str(t)) + '/Acc'), {('Acc_' + phase): correct_hypo[t]}, epoch)
    print(((('\t === hypothesiz **' + phase) + '** loss \n') + str(loss_hypo_vlue)))
    print(((('\t === hypothesiz **' + phase) + '** accuracy \n') + str((correct_hypo * 100))))
    return correct_hypo