diff --git a/x2paddle/op_mapper/pytorch2paddle/prim2code.py b/x2paddle/op_mapper/pytorch2paddle/prim2code.py index 4834cd9b7250e91f21edc9ae6699f0d7cec1bd0e..673456ce931d1329a29720915f183f67a6ad1dae 100755 --- a/x2paddle/op_mapper/pytorch2paddle/prim2code.py +++ b/x2paddle/op_mapper/pytorch2paddle/prim2code.py @@ -72,7 +72,7 @@ def prim_add_(layer, forward_func=[], layer_id=None, different_attrs=None): - if layer.attrs["alpha"] == 1: + if abs(layer.attrs["alpha"] - 1.) < 1e-6: line = "{} = {} + {}".format(layer.outputs[0], get_value(layer, "x", different_attrs), get_value(layer, "y", different_attrs))