diff --git a/x2paddle/op_mapper/paddle_op_mapper.py b/x2paddle/op_mapper/paddle_op_mapper.py index 203fc2301831269579f4784993ee121195fb3064..eea738419746d9e632fe3bdfd8d51cd1c5181a1f 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')