From 78deb175b390b508a48c986bd8b84c3243aee81e Mon Sep 17 00:00:00 2001 From: Rob Suderman Date: Fri, 16 Aug 2024 09:23:47 -0700 Subject: [PATCH] [onnx] Fix shortcircuit path (#3633) The implementation was short circuiting the second result. Updated to guarantee we do not short circuit. --- .../TorchOnnxToTorch/OnnxRecurrentLayerOpExpanders.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Conversion/TorchOnnxToTorch/OnnxRecurrentLayerOpExpanders.cpp b/lib/Conversion/TorchOnnxToTorch/OnnxRecurrentLayerOpExpanders.cpp index 16e012b6f..b18cd09f0 100644 --- a/lib/Conversion/TorchOnnxToTorch/OnnxRecurrentLayerOpExpanders.cpp +++ b/lib/Conversion/TorchOnnxToTorch/OnnxRecurrentLayerOpExpanders.cpp @@ -229,8 +229,10 @@ LogicalResult OnnxRnnExpander(OpBinder binder, // Result types ValueTensorType yTy, Y_hType; - if (binder.tensorResultTypeAtIndex(yTy, 0) && - binder.tensorResultTypeAtIndex(Y_hType, 1)) { + auto hasResult0 = binder.tensorResultTypeAtIndex(yTy, 0); + auto hasResult1 = binder.tensorResultTypeAtIndex(Y_hType, 1); + + if (hasResult0 && hasResult1) { return rewriter.notifyMatchFailure(binder.op, "At least one output must be present"); }