Skip to content

A typo in task.py? It should be "m_.np" not "m.np", or that will raise an attr error. #1

@peterhuang621

Description

@peterhuang621

in ultralytics/nn/task.py line 3123:

m.np = sum(x.numel() for x in m_.parameters()) # number params
m_.i, m_.f, m_.type = i + 4 if backbone else i, f, t # attach index, 'from' index, type

this line keeps throwing me error that
"LOGGER.info(f"{i:>3}{f!s:>20}{n_:>3}{m_.np:10.0f} {t:<45}{args!s:<30}")"
get no attr np for m_

I checked the offical ultralytics task.py which should be
m_.np = sum(x.numel() for x in m_.parameters()) # number params

not m.np. That seems like a small typo, could you pls check it again?

I turn it into m_.np and run the code successfully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions