From 4dd17f0b711523223e41606d9b7b6023b9149d46 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Mon, 8 Jan 2024 14:26:38 -0800 Subject: [PATCH] Fixing implicit double->float truncation warnings. (#2733) Floating-point literals should use the correct type specifier. --- lib/Conversion/TorchOnnxToTorch/DefaultDomainAtoF.cpp | 4 ++-- lib/Conversion/TorchOnnxToTorch/DefaultDomainGtoP.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/Conversion/TorchOnnxToTorch/DefaultDomainAtoF.cpp b/lib/Conversion/TorchOnnxToTorch/DefaultDomainAtoF.cpp index 86f23bee162c..83aa0a185fac 100644 --- a/lib/Conversion/TorchOnnxToTorch/DefaultDomainAtoF.cpp +++ b/lib/Conversion/TorchOnnxToTorch/DefaultDomainAtoF.cpp @@ -184,8 +184,8 @@ void mlir::torch::onnx_c::populateDefaultDomainAtoF( binder.tensorOperandAtIndex(bias, 2) || binder.tensorOperandAtIndex(runningMean, 3) || binder.tensorOperandAtIndex(runningVar, 4) || - binder.f32FloatAttr(momentum, "momentum", 0.9) || - binder.f32FloatAttr(eps, "epsilon", 1e-05) || + binder.f32FloatAttr(momentum, "momentum", 0.9f) || + binder.f32FloatAttr(eps, "epsilon", 1e-05f) || binder.tensorResultType(resultType)) return failure(); diff --git a/lib/Conversion/TorchOnnxToTorch/DefaultDomainGtoP.cpp b/lib/Conversion/TorchOnnxToTorch/DefaultDomainGtoP.cpp index d154edb1ab75..ee1ae6bb65be 100644 --- a/lib/Conversion/TorchOnnxToTorch/DefaultDomainGtoP.cpp +++ b/lib/Conversion/TorchOnnxToTorch/DefaultDomainGtoP.cpp @@ -34,8 +34,8 @@ void mlir::torch::onnx_c::populateDefaultDomainGtoP( Value tensorOperand; float alpha, beta; if (binder.tensorOperand(tensorOperand) || - binder.f32FloatAttr(alpha, "alpha", 0.2) || - binder.f32FloatAttr(beta, "beta", 0.5) || + binder.f32FloatAttr(alpha, "alpha", 0.2f) || + binder.f32FloatAttr(beta, "beta", 0.5f) || binder.tensorResultType(resultType)) return failure(); @@ -276,8 +276,8 @@ void mlir::torch::onnx_c::populateDefaultDomainGtoP( binder.tensorOperandAtIndex(c, 2) || binder.s64IntegerAttr(transA, "transA", 0) || binder.s64IntegerAttr(transB, "transB", 0) || - binder.f32FloatAttr(alpha, "alpha", 1.0) || - binder.f32FloatAttr(beta, "beta", 1.0) || + binder.f32FloatAttr(alpha, "alpha", 1.0f) || + binder.f32FloatAttr(beta, "beta", 1.0f) || binder.tensorResultType(resultType)) return failure(); @@ -417,7 +417,7 @@ void mlir::torch::onnx_c::populateDefaultDomainGtoP( float alpha; if (binder.tensorOperand(operand) || binder.tensorResultType(resultType) || - binder.f32FloatAttr(alpha, "alpha", 0.01)) + binder.f32FloatAttr(alpha, "alpha", 0.01f)) return failure(); Value constAlpha = rewriter.create( binder.getLoc(), rewriter.getType(),