Skip to content

🐛 [Bug] Numerical error with dynamic shape support for aten.linear #3022

Closed
@chohk88

Description

@chohk88

Bug Description

In the recent PR (#3011), we added dynamic shape support for the aten.linear operation. During testing, an assertion error was encountered when using torch.randn for weight initialization. This issue needs to be addressed and resolved.

Error Message:

AssertionError: Tensor-likes are not close! 
Mismatched elements: 323 / 2304 (14.0%)
Greatest absolute difference: 0.015128374099731445 at index (1, 1, 139) (up to 0.001 allowed) 
Greatest relative difference: 3.242828845977783 at index (1, 1, 154) (up to 0.001 allowed)

The error suggests a numerical discrepancy, with mismatched elements and significant differences in some tensor values.
No such error occurs when weights are initialized using torch.rand.

Reproduce

In the current dynamic shape test, weights are generated using self.weight = torch.rand(weight_shape). Changing this line to self.weight = torch.randn(weight_shape) causes the aforementioned error to occur.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions