-
Notifications
You must be signed in to change notification settings - Fork 130
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
fix SyntaxWarning #954
base: master
Are you sure you want to change the base?
fix SyntaxWarning #954
Conversation
@@ -1380,7 +1380,7 @@ def get_constraints_value(self): | |||
c += self.spatial_smoothing * self.get_output_spatial_smoothing_energy() | |||
if self.darc1: | |||
c += self.darc1 * self.get_darc1() | |||
if c is 0: | |||
if c == 0: |
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.
This is wrong in case c
is a tf.Tensor
or numpy.ndarray
.
Same also for all the other changes.
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.
It's not as simple (that's why I did not do it yet).
Basically you need isinstance(c, (int, float, numpy.number))
or so.
I see. It seems that all tests pass though, so it's maybe difficult to tell what would be correct and doesn't break any setups, right? |
But still it should be done like that. This just shows that the tests don't cover this. I wonder actually, I thought e.g. |
When running RETURNN, I get
I don't see a reason to do it the way it is currently done, so we could just fix it like proposed here.