Skip to content

Zeroshot-classification accuracy function dimensionality bug #147

@KarthikL1729

Description

@KarthikL1729

I was using the zeroshot_classification.py accuracy function to calculate top 1 and top 5 accuracy. I passed two tensors as required: output with shape [50000, 1000] and target with shape [50000] to it, and got a TypeError: only 0-dimensional arrays can be converted to Python scalars error from the accuracy function. I fixed it by adding a squeeze function to the result computation.

Unsure if this is a bug or if there is a different intended way of using it. Can open a PR if this is a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions