Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

L2 norm for fp16 goes to nan, needs to be fixed #11403

Description

@rahul003

When .norm() method is called on a float16 array it tries to compute the norm in fp16, which causes the squared sum to go out of range and causes nan as output. Large normalizations should be kept in float32, similar to how it's done for softmax and batchnorm. Ideally this should be done by accumulating the squared sum into a float32 buffer.
This problem might affect the L2 norm operator as well. Haven't verified that.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions