def mat_norm(input, porder=1.0, axis=None):
    '\n        NOTE:\n            Calculate the matrix norm of a square matrix or batches of square matrices,\n            when porder is in (1, -1, inf, -inf)\n        '
    reduce_all = (True if ((axis is None) or (axis == [])) else False)
    axis = (axis if ((axis != None) and (axis != [])) else [0])
    keepdim = False
    if paddle.in_dynamic_mode():
        abs_out = _C_ops.abs(input)
        sum_out = _C_ops.reduce_sum(abs_out, 'dim', axis, 'keepdim', keepdim, 'reduce_all', reduce_all)
        if ((porder == 1) or (porder == np.inf)):
            return _C_ops.reduce_max(sum_out, 'dim', [(- 1)], 'keepdim', keepdim, 'reduce_all', reduce_all)
        if ((porder == (- 1)) or (porder == (- np.inf))):
            return _C_ops.reduce_min(sum_out, 'dim', [(- 1)], 'keepdim', keepdim, 'reduce_all', reduce_all)
    block = LayerHelper('norm', **locals())
    abs_out = block.create_variable_for_type_inference(dtype=block.input_dtype())
    sum_out = block.create_variable_for_type_inference(dtype=block.input_dtype())
    out = block.create_variable_for_type_inference(dtype=block.input_dtype())
    block.append_op(type='abs', inputs={'X': input}, outputs={'Out': abs_out})
    block.append_op(type='reduce_sum', inputs={'X': abs_out}, outputs={'Out': sum_out}, attrs={'dim': axis, 'keep_dim': keepdim, 'reduce_all': reduce_all})
    if ((porder == 1) or (porder == np.inf)):
        block.append_op(type='reduce_max', inputs={'X': sum_out}, outputs={'Out': out}, attrs={'dim': [(- 1)], 'keep_dim': keepdim, 'reduce_all': reduce_all})
    if ((porder == (- 1)) or (porder == (- np.inf))):
        block.append_op(type='reduce_min', inputs={'X': sum_out}, outputs={'Out': out}, attrs={'dim': [(- 1)], 'keep_dim': keepdim, 'reduce_all': reduce_all})
    return out
NOTE:
    Calculate the matrix norm of a square matrix or batches of square matrices,
    when porder is in (1, -1, inf, -inf)
def mat_norm(input, porder=1.0, axis=None):
    '\n        NOTE:\n            Calculate the matrix norm of a square matrix or batches of square matrices,\n            when porder is in (1, -1, inf, -inf)\n        '
    reduce_all = (True if ((axis is None) or (axis == [])) else False)
    axis = (axis if ((axis != None) and (axis != [])) else [0])
    keepdim = False
    if paddle.in_dynamic_mode():
        abs_out = _C_ops.abs(input)
        sum_out = _C_ops.reduce_sum(abs_out, 'dim', axis, 'keepdim', keepdim, 'reduce_all', reduce_all)
        if ((porder == 1) or (porder == np.inf)):
            return _C_ops.reduce_max(sum_out, 'dim', [(- 1)], 'keepdim', keepdim, 'reduce_all', reduce_all)
        if ((porder == (- 1)) or (porder == (- np.inf))):
            return _C_ops.reduce_min(sum_out, 'dim', [(- 1)], 'keepdim', keepdim, 'reduce_all', reduce_all)
    block = LayerHelper('norm', **locals())
    abs_out = block.create_variable_for_type_inference(dtype=block.input_dtype())
    sum_out = block.create_variable_for_type_inference(dtype=block.input_dtype())
    out = block.create_variable_for_type_inference(dtype=block.input_dtype())
    block.append_op(type='abs', inputs={'X': input}, outputs={'Out': abs_out})
    block.append_op(type='reduce_sum', inputs={'X': abs_out}, outputs={'Out': sum_out}, attrs={'dim': axis, 'keep_dim': keepdim, 'reduce_all': reduce_all})
    if ((porder == 1) or (porder == np.inf)):
        block.append_op(type='reduce_max', inputs={'X': sum_out}, outputs={'Out': out}, attrs={'dim': [(- 1)], 'keep_dim': keepdim, 'reduce_all': reduce_all})
    if ((porder == (- 1)) or (porder == (- np.inf))):
        block.append_op(type='reduce_min', inputs={'X': sum_out}, outputs={'Out': out}, attrs={'dim': [(- 1)], 'keep_dim': keepdim, 'reduce_all': reduce_all})
    return out