def compute_logits(self, hidden):
        """Compute full vector of logits

        Adapted from https://github.com/kimiyoung/transformer-xl/issues/88
        """
        hidden = hidden.reshape(-1, hidden.size(-1))

        if self.n_clusters == 0:
            logits = self._compute_logit(hidden, self.out_layers_weights[0],
                                        self.out_layers_biases[0], self.get_out_proj(0))
            return logits
        else:
            # construct weights and biases
            weights, biases = [], []
            for i in range(len(self.cutoffs)):
                if self.div_val == 1:
                    l_idx, r_idx = self.cutoff_ends[i], self.cutoff_ends[i + 1]
                    weight_i = self.out_layers_weights[0][l_idx:r_idx]
                    bias_i = self.out_layers_biases[0][l_idx:r_idx]
                else:
                    weight_i = self.out_layers_weights[i]
                    bias_i = self.out_layers_biases[i]

                if i == 0:
                    weight_i = torch.cat(
                        [weight_i, self.cluster_weight], dim=0)
                    bias_i = torch.cat(
                        [bias_i, self.cluster_bias], dim=0)

                weights.append(weight_i)
                biases.append(bias_i)

            head_weight, head_bias, head_proj = weights[0], biases[0], self.get_out_proj(0)

            head_logit = self._compute_logit(hidden, head_weight, head_bias, head_proj)
            head_logprob = F.log_softmax(head_logit, dim=1)

            out_full_logps = [head_logprob[:, :self.cutoffs[0]]]
            offset = 0
            cutoff_values = [0] + self.cutoffs

            for i in range(1, len(cutoff_values) - 1):
                l_idx, r_idx = cutoff_values[i], cutoff_values[i + 1]
                head_logprob_i = head_logprob # .index_select(0, indices_i)

                if i == 0:
                    logprob_i = head_logprob_i
                else:
                    weight_i, bias_i, proj_i = weights[i], biases[i], self.get_out_proj(i)

                    hidden_i = hidden # .index_select(0, indices_i)

                    tail_logit_i = self._compute_logit(hidden_i, weight_i, bias_i, proj_i)
                    tail_logprob_i = F.log_softmax(tail_logit_i, dim=1)
                    logprob_i = head_logprob_i[:, -i].view(-1, 1) + tail_logprob_i

                offset += logprob_i.size(0)
                out_full_logps.append(logprob_i)
            out_full_logps = torch.cat(out_full_logps, dim = 1)
            # print(torch.sum(out_full_ps), out_full_ps.shape)
            return out_full_logps
Compute full vector of logits

        Adapted from https://github.com/kimiyoung/transformer-xl/issues/88
        
analyze/convnexts4nd/src/models/nn/adaptive_softmax.py