Skip to content

Commit 4dd17f0

Browse files
authored
Fixing implicit double->float truncation warnings. (#2733)
Floating-point literals should use the correct type specifier.
1 parent 985e779 commit 4dd17f0

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

lib/Conversion/TorchOnnxToTorch/DefaultDomainAtoF.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ void mlir::torch::onnx_c::populateDefaultDomainAtoF(
184184
binder.tensorOperandAtIndex(bias, 2) ||
185185
binder.tensorOperandAtIndex(runningMean, 3) ||
186186
binder.tensorOperandAtIndex(runningVar, 4) ||
187-
binder.f32FloatAttr(momentum, "momentum", 0.9) ||
188-
binder.f32FloatAttr(eps, "epsilon", 1e-05) ||
187+
binder.f32FloatAttr(momentum, "momentum", 0.9f) ||
188+
binder.f32FloatAttr(eps, "epsilon", 1e-05f) ||
189189
binder.tensorResultType(resultType))
190190
return failure();
191191

lib/Conversion/TorchOnnxToTorch/DefaultDomainGtoP.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ void mlir::torch::onnx_c::populateDefaultDomainGtoP(
3434
Value tensorOperand;
3535
float alpha, beta;
3636
if (binder.tensorOperand(tensorOperand) ||
37-
binder.f32FloatAttr(alpha, "alpha", 0.2) ||
38-
binder.f32FloatAttr(beta, "beta", 0.5) ||
37+
binder.f32FloatAttr(alpha, "alpha", 0.2f) ||
38+
binder.f32FloatAttr(beta, "beta", 0.5f) ||
3939
binder.tensorResultType(resultType))
4040
return failure();
4141

@@ -276,8 +276,8 @@ void mlir::torch::onnx_c::populateDefaultDomainGtoP(
276276
binder.tensorOperandAtIndex(c, 2) ||
277277
binder.s64IntegerAttr(transA, "transA", 0) ||
278278
binder.s64IntegerAttr(transB, "transB", 0) ||
279-
binder.f32FloatAttr(alpha, "alpha", 1.0) ||
280-
binder.f32FloatAttr(beta, "beta", 1.0) ||
279+
binder.f32FloatAttr(alpha, "alpha", 1.0f) ||
280+
binder.f32FloatAttr(beta, "beta", 1.0f) ||
281281
binder.tensorResultType(resultType))
282282
return failure();
283283

@@ -417,7 +417,7 @@ void mlir::torch::onnx_c::populateDefaultDomainGtoP(
417417
float alpha;
418418
if (binder.tensorOperand(operand) ||
419419
binder.tensorResultType(resultType) ||
420-
binder.f32FloatAttr(alpha, "alpha", 0.01))
420+
binder.f32FloatAttr(alpha, "alpha", 0.01f))
421421
return failure();
422422
Value constAlpha = rewriter.create<Torch::ConstantFloatOp>(
423423
binder.getLoc(), rewriter.getType<Torch::FloatType>(),

0 commit comments

Comments
 (0)