You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
where the code assumes the underlying object is being mutated and the parameters don't actually pass through.
I guess there might be a couple of ways forward, depending on how Tensorflow prefers the C++ API:
Decide the Attrs chaining methods mutate the underlying object and fix the code generation.
Decide the Attrs chaining methods return new instances, and fix the uses.
Suggestions?
Fwiw if option 2, it might be nice to add TF_MUST_USE_RESULT to the generated API. (Unfortunately a long-standing bug in gcc means this may be unreliable as an actual error across versions of gcc that contributors may use.)
@kbsriram thanks for pointing out the bug. I am not a fan of mutable state, so my natural inclination is towards option 2. Adding TF_MUST_USE_RESULT to the generated API would simply point out the existing erroneous uses as compiler errors.
@keveman thanks for the note! Sgtm - don't have a strong opinion on this. But would like to make progress on fixes and (for option 2 as you note) add a bit of a compile-time safety net for new code.
Tentatively predicated on option 2, suggestions on next steps? If someone is already on it, awesome - otherwise, I can sign up for a pull request on this.
The generated op::Attrs struct returns new instances on its chainable methods, and doesn't change the original object.
tensorflow/tensorflow/cc/framework/cc_op_gen.cc
Line 701 in d7d7f4e
There are a few related issues e.g.
tensorflow/tensorflow/cc/gradients/nn_grad.cc
Line 164 in 6fdb9ad
I guess there might be a couple of ways forward, depending on how Tensorflow prefers the C++ API:
Suggestions?
Fwiw if option 2, it might be nice to add TF_MUST_USE_RESULT to the generated API. (Unfortunately a long-standing bug in gcc means this may be unreliable as an actual error across versions of gcc that contributors may use.)
/cc @suharshs @keveman
The text was updated successfully, but these errors were encountered: