From 0489f6d5333d4e75d06a57c8bdb3a89e077bcf88 Mon Sep 17 00:00:00 2001 From: Channingss Date: Fri, 3 Jul 2020 07:50:13 +0000 Subject: [PATCH] fix bug --- x2paddle/op_mapper/paddle_op_mapper.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/x2paddle/op_mapper/paddle_op_mapper.py b/x2paddle/op_mapper/paddle_op_mapper.py index 203fc23..eea7384 100644 --- a/x2paddle/op_mapper/paddle_op_mapper.py +++ b/x2paddle/op_mapper/paddle_op_mapper.py @@ -308,8 +308,16 @@ class PaddleOpMapper(object): scale = op.attr('scale') bias = op.attr('bias') if math.fabs(scale - 1.0) < 1e-06 and math.fabs(bias - 0.0) < 1e-06: + name = op.output('Out')[0] + var = block.var(name) + dtype = self.paddle_onnx_dtype_map[var.dtype] node = helper.make_node( - 'Identity', inputs=op.input('X'), outputs=op.output('Out')) + 'Cast', + inputs=op.input('X'), + outputs=op.output('Out'), + to=dtype) + #node = helper.make_node( + # 'Identity', inputs=op.input('X'), outputs=op.output('Out')) return node else: scale_name = self.get_name(op.type, 'scale') -- GitLab