def pretrain_loss(self, target, dis, start_letter=cfg.start_letter):
        """
        Returns the pretrain_generator Loss for predicting target sequence.

        Inputs: target, dis, start_letter
            - target: batch_size * seq_len

        """
        batch_size, seq_len = target.size()
        _, feature_array, goal_array, leak_out_array = self.forward_leakgan(target, dis, if_sample=False, no_log=False,
                                                                            start_letter=start_letter)

        # Manager loss
        mana_cos_loss = self.manager_cos_loss(batch_size, feature_array,
                                              goal_array)  # batch_size * (seq_len / step_size)
        manager_loss = -torch.sum(mana_cos_loss) / (batch_size * (seq_len // self.step_size))

        # Worker loss
        work_nll_loss = self.worker_nll_loss(target, leak_out_array)  # batch_size * seq_len
        work_loss = torch.sum(work_nll_loss) / (batch_size * seq_len)

        return manager_loss, work_loss

        Returns the pretrain_generator Loss for predicting target sequence.

        Inputs: target, dis, start_letter
            - target: batch_size * seq_len

        
models/LeakGAN_G.py