Currently, calling withControlDependencies in Eager mode will cause an exception when the op is build. Ideally, this wouldn't be called at all, as it does nothing: if you have a Operand to pass into it, it has already been calculated. However, when writing code that should work in eager or graph mode (like tensorflow-framework) having to check for this every time you want to add a control dependency is annoying and currently doesn't seem to be done. Semantically, using a control dependency in eager mode is a no-op.
I'd propose making EagerOperationBuilder.addControlInput a no-op instead of throwing an exception for the reasons above. This could also be handled in the Scope methods if you don't want to change EagerOperationBuilder for some reason. I can handle the PR if this is approved.
Currently, calling
withControlDependenciesin Eager mode will cause an exception when the op is build. Ideally, this wouldn't be called at all, as it does nothing: if you have a Operand to pass into it, it has already been calculated. However, when writing code that should work in eager or graph mode (liketensorflow-framework) having to check for this every time you want to add a control dependency is annoying and currently doesn't seem to be done. Semantically, using a control dependency in eager mode is a no-op.I'd propose making
EagerOperationBuilder.addControlInputa no-op instead of throwing an exception for the reasons above. This could also be handled in theScopemethods if you don't want to changeEagerOperationBuilderfor some reason. I can handle the PR if this is approved.