diff --git a/lib/Conversion/TorchOnnxToTorch/OnnxRecurrentLayerOpExpanders.cpp b/lib/Conversion/TorchOnnxToTorch/OnnxRecurrentLayerOpExpanders.cpp index 16e012b6f585..b18cd09f030a 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"); }