python/paddle/incubate/operators/softmax_mask_fuse_upper_triangle.py
def softmax_mask_fuse_upper_triangle(x):
    """
    Fuse softmax mask together without even give a mask.
    Under GPT model, the mask is always be a upper triangle
    so we can simply mask the upper triangle part of x to get the mask result
    :param x: the input x (rst of QK)
    :return: the result of softmax mask fuse (upper triangle)
    """
    if in_dygraph_mode():
        out = core.ops.fused_softmax_mask_upper_triangle(x)
        return out

    helper = LayerHelper('fused_softmax_mask_upper_triangle', **locals())

    out = helper.create_variable_for_type_inference(dtype=x.dtype)

    helper.append_op(
        type='fused_softmax_mask_upper_triangle',
        inputs={'X': [x]},
        outputs={'Out': [out]})
    return out

    Fuse softmax mask together without even give a mask.
    Under GPT model, the mask is always be a upper triangle
    so we can simply mask the upper triangle part of x to get the mask result
    :param x: the input x (rst of QK)
    :return: the result of softmax mask fuse (upper triangle)
    
Fuse softmax mask together without even give a mask.
Under GPT model, the mask is always be a upper triangle
so we can simply mask the upper triangle part of x to get the mask result
Fuse softmax mask together without even give a mask . Under GPT model the mask is always be a upper triangle so we can simply mask the upper triangle part of x to get the mask result
def softmax_mask_fuse_upper_triangle(x):
    if in_dygraph_mode():
        out = core.ops.fused_softmax_mask_upper_triangle(x)
        return out
    helper = LayerHelper('fused_softmax_mask_upper_triangle', **locals())
    out = helper.create_variable_for_type_inference(dtype=x.dtype)
    helper.append_op(
        type='fused_softmax_mask_upper_triangle',
        inputs={'X': [x]},
        outputs={'Out': [out]})
    return out
def softmax_mask_fuse_upper_triangle ( x ) : if in_dygraph_mode ( ) : out = core . ops . fused_softmax_mask_upper_triangle ( x ) return out helper = LayerHelper ( 'fused_softmax_mask_upper_triangle' , ** locals ( ) ) out = helper . create_variable_for_type_inference ( dtype = x . dtype ) helper . append_op ( type = 'fused_softmax_mask_upper_triangle' , inputs = { 'X' : [ x ] } , outputs = { 'Out' : [ out ] } ) return out
Fuse softmax mask together without even give a mask.
Fuse softmax mask together without even give a mask .
"""
    Fuse softmax mask together without even give a mask.
    Under GPT model, the mask is always be a upper triangle
    so we can simply mask the upper triangle part of x to get the mask result
    :param x: the input x (rst of QK)
    :return: the result of softmax mask fuse (upper triangle)
    """
the result of softmax mask fuse (upper triangle)
the result of softmax mask fuse ( upper triangle )
x
the input x (rst of QK)
the input x ( rst of QK )