(self, batch_size, inputs_len)
return mask.unsqueeze(0).expand(batch_size, inputs_len, inputs_len)
Builds the mask to compute the cumulative average as described in
        https://arxiv.org/abs/1805.00631 -- Figure 3

        Args:
            batch_size (int): batch size
            inputs_len (int): length of the inputs

        Returns:
            (`FloatTensor`):

            * A Tensor of shape `[batch_size x input_len x input_len]`
Builds the mask to compute the cumulative average as described in
        https://arxiv.org/abs/1805.00631 -- Figure 3
Builds the mask to compute the cumulative average as described in https : // arxiv . org / abs / 1805 . 00631 -- Figure 3
def cumulative_average_mask(self, batch_size, inputs_len):
        """
        Builds the mask to compute the cumulative average as described in
        https://arxiv.org/abs/1805.00631 -- Figure 3

        Args:
            batch_size (int): batch size
            inputs_len (int): length of the inputs

        Returns:
            (`FloatTensor`):

            * A Tensor of shape `[batch_size x input_len x input_len]`
        """

        triangle = torch.tril(torch.ones(inputs_len, inputs_len))
        weights = torch.ones(1, inputs_len) / torch.arange(
            1, inputs_len + 1, dtype=torch.float)
        mask = triangle * weights.transpose(0, 1)

        return mask.unsqueeze(0).expand(batch_size, inputs_len, inputs_len)
def cumulative_average_mask ( self , batch_size , inputs_len ) : triangle = torch . tril ( torch . ones ( inputs_len , inputs_len ) ) weights = torch . ones ( 1 , inputs_len ) / torch . arange ( 1 , inputs_len + 1 , dtype = torch . float ) mask = triangle * weights . transpose ( 0 , 1 ) return mask . unsqueeze ( 0 ) . expand ( batch_size , inputs_len , inputs_len )