NameError: name ‘fprint‘ is not defined

The problem I encountered was in the 'thop' library. First, I found the source code of this line. There is no fprint, which means it has not been defined. We will change it and use the format of print.

thop.profile(model, inputs=(input,))Error
Solution:

        if m_type in custom_ops:  # if defined both op maps, use custom_ops to overwrite.
            fn = custom_ops[m_type]
            if m_type not in types_collection and verbose:
            	# fprint改为print
                fprint("[INFO] Customize rule %s() %s." % (fn.__qualname__, m_type))
        elif m_type in register_hooks:
            fn = register_hooks[m_type]
            if m_type not in types_collection and verbose:
            	# fprint改为print
                fprint("[INFO] Register %s() for %s." % (fn.__qualname__, m_type))

It was later found that setting the parameter verbose to false can also work.

It's okay, record it.

Guess you like

Origin blog.csdn.net/qq_41776453/article/details/120973932
Recommended