-
Notifications
You must be signed in to change notification settings - Fork 433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A fix for seed attribute in the keras random normal generator #2126
Conversation
…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>
@@ -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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to also update this for version_1(line 63)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @fatcat-z you're quite right, ill update version_1 as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little confused: is this behavior (using seed2 instead of seed) same among different TF versions? Did it change after one of tf version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I've seen and tested, version_1 behaviour is also relevant for TF version.2
when the random generator dim/shape are constant and not derived from the data
batch size or any other dependent size.
I'm checking with TF V1 whether it was changed.
Signed-off-by: inonbe <inonb@waves.com>
Signed-off-by: inonbe <inonb@waves.com>
Signed-off-by: inonbe <inonb@waves.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for your contributions!
The seed attribute was not passing to the converted onnx model due to that it exists in "seed2" attribute instead of "seed" and its internal type is Integer and not float.
Currently there is no impact on existing unit_tests ("test_auto_encoder" for example) or need for new unit test
since still the random generator behaves differently on various engines.