def METHOD_NAME(ctx, output_grads):
    (
        use_biases_t,
        heads_t,
        matmul2_results,
        dropout_results,
        softmax_results,
        bmm1_results,
        pad_mask,
        mask_additive_t,
        input_lin_results,
        inputs,
        input_weights,
        output_weights,
        dropout_mask,
        dropout_prob_t,
    ) = ctx.saved_tensors
    if use_biases_t[0]:
        if not mask_additive_t[0]:
            (
                input_grads,
                input_weight_grads,
                output_weight_grads,
                input_bias_grads,
                output_bias_grads,
            ) = fast_multihead_attn.self_attn_bias_backward(
                heads_t[0],
                output_grads,
                matmul2_results,
                dropout_results,
                softmax_results,
                input_lin_results,
                inputs,
                input_weights,
                output_weights,
                dropout_mask,
                dropout_prob_t[0],
            )
            # fast_self_multihead_attn_bias.backward(                          \
        else:
            (
                input_grads,
                input_weight_grads,
                output_weight_grads,
                input_bias_grads,
                output_bias_grads,
            ) = fast_multihead_attn.self_attn_bias_additive_mask_backward(
                heads_t[0],
                output_grads,
                matmul2_results,
                dropout_results,
                bmm1_results,
                pad_mask,
                input_lin_results,
                inputs,
                input_weights,
                output_weights,
                dropout_mask,
                dropout_prob_t[0],
            )
            # fast_self_multihead_attn_bias_additive_mask.backward(                          \
    else:
        input_bias_grads = None
        output_bias_grads = None
        input_grads, input_weight_grads, output_weight_grads = fast_multihead_attn.self_attn_backward(
            heads_t[0],
            output_grads,
            matmul2_results,
            dropout_results,
            softmax_results,
            input_lin_results,
            inputs,
            input_weights,
            output_weights,
            dropout_mask,
            dropout_prob_t[0],
        )
        # fast_self_multihead_attn.backward(                          \
    return (
        None,
        None,
        None,
        input_grads,
        input_weight_grads,
        output_weight_grads,
        input_bias_grads,
        output_bias_grads,
        None,
        None,
        None,
    )