src/transformers/models/yoso/modeling_yoso.py/YosoCumulation/forward
class YosoCumulation:    def forward(ctx, query_mask, key_mask, query, key, value, config):
        hash_code_len = config["hash_code_len"]

        expectation = (1 - torch.acos(torch.matmul(query, key.transpose(-1, -2))) / math.pi) ** hash_code_len
        expectation = expectation * query_mask[:, :, None] * key_mask[:, None, :]
        cumulation_value = torch.matmul(expectation, value)

        ctx.save_for_backward(query_mask, key_mask, expectation, query, key, value)
        ctx.config = config

        return cumulation_value