Commit c8f1a34b authored by Akshay Agrawal's avatar Akshay Agrawal Committed by TensorFlower Gardener
Browse files

Replace instances of `control_dependencies(None)` with `init_scope` when

initializing variables.

Today, when variables are constructed (Resource and otherwise), we lift certain
operations, including the VarHandleOp and initialization ops, out of all
control flow contexts; the mechanism for doing so is entering the context
manager returned by `control_dependencies(None)`. This change replaces various
instances of this mechanism with `init_scope`, which clears control dependencies, lifts ops out of function-building graphs, and pauses the gradient tape. As a result,
variables that are created inside graph functions will be automatically hoisted
into an outer context.

PiperOrigin-RevId: 183320576
parent 32a6eb80
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment