未验证 提交 b546438c 编写于 作者: W wenbin 提交者: GitHub

round (#48107)

上级 3501ff7d
......@@ -53,7 +53,8 @@ class ScaleOpConverter : public OpConverter {
nvinfer1::ILayer* layer = nullptr;
if (engine_->with_dynamic_shape()) {
nvinfer1::ITensor* bias_tensor =
is_int ? Add1DConstantLayer(static_cast<int>(bias))
is_int ? Add1DConstantLayer(
static_cast<int>(bias > 0 ? bias + 0.5 : bias - 0.5))
: Add1DConstantLayer(bias);
bool is_bias_0 = (bias < 1e-06 && bias > -1e-06);
......@@ -75,7 +76,8 @@ class ScaleOpConverter : public OpConverter {
is_scale_1 = false;
} else {
has_scale_tensor = false;
scale_tensor = is_int ? Add1DConstantLayer(static_cast<int>(scale))
scale_tensor = is_int ? Add1DConstantLayer(static_cast<int>(
scale > 0 ? scale + 0.5 : scale - 0.5))
: Add1DConstantLayer(scale);
is_scale_1 = ((scale - 1.0) < 1e-06 && (scale - 1.0) > -1e-06);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册