Browse Source

CheckInputFromValidContext when while_ctxt is null.

tags/v0.13
Oceania2018 5 years ago
parent
commit
ddd23e31e3
1 changed files with 12 additions and 1 deletions
  1. +12
    -1
      src/TensorFlowNET.Core/Operations/control_flow_util.py.cs

+ 12
- 1
src/TensorFlowNET.Core/Operations/control_flow_util.py.cs View File

@@ -132,7 +132,18 @@ namespace Tensorflow
if (while_ctxt == null)
{
throw new NotImplementedException("CheckInputFromValidContext");
// Neither op nor input_op is in a while loop, but one or both are in
// conds. We allow this, although execution will fail if the branch
// corresponding to input_op's cond context isn't taken.
if (input_while_ctxt == null)
valid = true;
// Invalid if op isn't in a while loop and input_op is. Unless...
if (IsLoopEnter(op))
// WhileContext._BuildLoop clears context for Enter nodes.
valid = true;
if (IsSwitch(op))
// CondContext.AddValue clears context for Switch nodes.
valid = true;
}
else if (IsContainingContext(while_ctxt, input_while_ctxt))
{


Loading…
Cancel
Save