Skip to content

Gracefully handle control dependencies in Eager enviroments #157

Description

@rnett

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions