def METHOD_NAME(model, inputs, custom_ops=None, num_levels=None):
    def _add_hooks(m):
        if len(list(m.children())) > 0:
            return
        m.register_buffer('total_ops', paddle.zeros([1], dtype='int64'))
        m.register_buffer('total_params', paddle.zeros([1], dtype='int64'))
        m_type = type(m)
        flops_fn = None
        if m_type in custom_ops:
            flops_fn = custom_ops[m_type]
            if m_type not in types_collection:
                print("Customize Function has been applied to {}.".format(
                    m_type))
        elif m_type in register_hooks:
            flops_fn = register_hooks[m_type]
            if m_type not in types_collection:
                print("{}'s FLOPs has been counted.".format(m_type))
        else:
            if m_type not in types_collection:
                print(
                    "Cannot find suitable count function for {}. Treat it as zero FLOPs."
                    .format(m_type))
        if flops_fn is not None:
            flops_handler = m.register_forward_post_hook(flops_fn)
            handler_collection.append(flops_handler)
        params_handler = m.register_forward_post_hook(count_parameters)
        io_handler = m.register_forward_post_hook(count_io_info)
        handler_collection.append(params_handler)
        handler_collection.append(io_handler)
        types_collection.add(m_type)
    if num_levels is not None and num_levels < 1:
        raise ValueError("`num_levels` must be a positive integer.")
    handler_collection = []
    types_collection = set()
    if custom_ops is None:
        custom_ops = {}
    training = model.training
    model.eval()
    model.apply(_add_hooks)
    with paddle.no_grad():
        model(inputs)
    if training:
        model.train()
    for handler in handler_collection:
        handler.remove()
    counters = {
        'Params (M)': lambda m: _to_mega(m.total_params),
        'FLOPs (G)': lambda m: _to_giga(m.total_ops)
    }
    stats = _count_layer_stats(model, counters, 1, [])
    if num_levels is not None:
        stats = list(filter(lambda info: info['Level'] <= num_levels, stats))
    table = _stats_to_table(
        stats, ['Layer Name', 'Input Shape', 'Output Shape', *counters.keys()])
    with _redirect_stdout_to_str() as sio:
        table.print_table()
        tab_info = sio.getvalue()
    logger.info('\n' + tab_info)