未验证 提交 ad522483 编写于 作者: 王明冬 提交者: GitHub

fix the crash when input variable is bool type, test=develop (#35176)

上级 e838cacf
......@@ -1378,7 +1378,7 @@ def save_inference_model(dirname,
with program_guard(main_program):
uniq_target_vars = []
for i, var in enumerate(target_vars):
if isinstance(var, Variable):
if isinstance(var, Variable) and var.dtype != paddle.bool:
var = layers.scale(
var, 1., name="save_infer_model/scale_{}".format(i))
uniq_target_vars.append(var)
......
......@@ -192,8 +192,9 @@ def normalize_program(program, feed_vars, fetch_vars):
with program_guard(program):
uniq_fetch_vars = []
for i, var in enumerate(fetch_vars):
var = layers.scale(
var, 1., name="save_infer_model/scale_{}".format(i))
if var.dtype != paddle.bool:
var = layers.scale(
var, 1., name="save_infer_model/scale_{}".format(i))
uniq_fetch_vars.append(var)
fetch_vars = uniq_fetch_vars
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册