From 599a42498a412d4690dbc107347867dac1acfb79 Mon Sep 17 00:00:00 2001 From: inonbe Date: Thu, 23 Feb 2023 11:33:02 +0200 Subject: [PATCH] A fix for seed field in the tf.keras random normal generator. The seed field was not passing to the converted onnx model due to that it exists in seed2 attribute instead of seed and its type is Integer and not float. Signed-off-by: inonbe --- tf2onnx/onnx_opset/generator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tf2onnx/onnx_opset/generator.py b/tf2onnx/onnx_opset/generator.py index 0b59dca6b..49af3d5ed 100644 --- a/tf2onnx/onnx_opset/generator.py +++ b/tf2onnx/onnx_opset/generator.py @@ -88,8 +88,8 @@ def version_9(cls, ctx, node, **kwargs): if node.inputs[0].is_const(): cls.version_1(ctx, node, **kwargs) else: - seed = node.get_attr("seed") - node.set_attr("seed", float(seed.f)) + seed = node.get_attr("seed2") + node.set_attr("seed", float(seed.i)) cast_node = ctx.make_node("Cast", [node.input[0]], attr={'to': onnx_pb.TensorProto.INT64}) const_node = ctx.make_node("ConstantOfShape", cast_node.output) inputs = node.input.copy()