[Relax] Legalize nn.dropout as inference no-op#19841
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds support for converting ONNX Dropout nodes to Relax expressions and legalizes the relax.nn.dropout operator as a no-op during inference (returning the input and an all-ones mask). It also includes corresponding tests for both the ONNX frontend and the legalization transformation. The reviewer pointed out that in ONNX Opset 12 and later, the ratio parameter is passed as an optional second input tensor rather than an attribute, meaning the current implementation would ignore custom ratios in newer models. A code suggestion was provided to handle both cases.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Signed-off-by: Guan-Ming (Wesley) Chiu <105915352+guan404ming@users.noreply.github.com>
1495351 to
54108cf
Compare
Related Issue
Closed #19695
Why
Building any module containing relax.nn.dropout crashed in VM codegen because the op had no real legalization, and the ONNX frontend could not import it
How