Skip to content

Conversation

@vacu9708
Copy link
Contributor

@vacu9708 vacu9708 commented May 15, 2025

Summary

This PR resolves issue #17899 where an error occurs converting operator LayerNormalization.

Reference

According to the ONNX documentation for the LayerNormalization operator (opset 17), the operator accepts between 2 and 3 inputs:

  • X: Input tensor to be normalized.
  • Scale: Scale tensor.
  • B (optional): Bias tensor.

This means that the bias input (B) is optional. The operator is designed to function correctly even when the bias is not provided.

Update

This change updates the LayerNormalization converter to support ONNX models where the optional bias input is not provided. When bias is missing, an empty bias tensor is generated.

@vacu9708 vacu9708 force-pushed the onnx_LayerNormalization branch from eb90f96 to d6f230c Compare May 15, 2025 01:28
@vacu9708
Copy link
Contributor Author

@tvm-bot re-run

@Hzfengsy
Copy link
Member

Would be great if you could add a testcase for it :)

This change updates the LayerNormalization converter to support ONNX
models where the optional bias input is not provided.
When bias is missing, an empty bias tensor is generated.

This behavior aligns with the ONNX’s spec for LayerNormalization (opset 17+) where
the bias input is officially optional.
@vacu9708 vacu9708 force-pushed the onnx_LayerNormalization branch from d6f230c to 2eea7f8 Compare May 15, 2025 04:46
@vacu9708
Copy link
Contributor Author

@Hzfengsy
Thanks for your feedback. I added the corresponding test case.

@Hzfengsy Hzfengsy merged commit 196b694 into apache:main May 15, 2025
10 checks passed
@vacu9708 vacu9708 deleted the onnx_LayerNormalization branch July 9, 2025 23:51
ShiboXing pushed a commit to ShiboXing/tvm that referenced this pull request Aug 10, 2025
…he#17980)

This change updates the LayerNormalization converter to support ONNX
models where the optional bias input is not provided.
When bias is missing, an empty bias tensor is generated.

This behavior aligns with the ONNX’s spec for LayerNormalization (opset 17+) where
the bias input is officially optional.
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

Successfully merging this pull request may close these issues.

2 participants