Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue: Incorrect comment in linear function #579

Open
maxiao001 opened this issue Feb 5, 2025 · 0 comments
Open

Issue: Incorrect comment in linear function #579

maxiao001 opened this issue Feb 5, 2025 · 0 comments

Comments

@maxiao001
Copy link

maxiao001 commented Feb 5, 2025

The comment in the linear function regarding weight.element_size() contains inaccuracies:

    """
    ...

    Notes:
        - If `weight` is quantized (e.g., `element_size() > 1`), a dequantized version 
          is used for computation.
        ...
    """

This comment has two problems:

  1. Incorrect "quantized" condition: element_size() > 1 indicates that the weight tensor is not quantized. Quantized tensors have an element size of 1, while higher precision formats like float32 and bfloat16 have element sizes greater than 1.

  2. Misleading "dequantized version" phrase: The code does not perform any dequantization when weight.element_size() > 1. It directly uses the original weight tensor.

Proposed solution:

Change the comment to accurately reflect the code's logic. A more accurate comment would be:

    """
    ...

    Notes:
        - If `weight` is in a higher precision format (e.g., float32 or bfloat16), then `element_size() > 1`, and the original
          weight tensor is used for computation.
        ...
    """

This revised comment clarifies that no dequantization is performed and the original higher-precision weights are used directly when element_size() > 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant