Skip to content

Commit

Permalink
A fix for seed field in the tf.keras random normal generator. The see…
Browse files Browse the repository at this point in the history
…d 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 <inonb@waves.com>
  • Loading branch information
inonbe committed Feb 23, 2023
1 parent 82ae7c4 commit 599a424
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tf2onnx/onnx_opset/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 599a424

Please sign in to comment.