MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / CreateBody

Function CreateBody

tensorflow/cc/ops/while_loop.cc:121–144  ·  view source on GitHub ↗

Create the body subgraph defined by `body`. `outputs` must be non-null and empty.

Source from the content-addressed store, hash-verified

119// Create the body subgraph defined by `body`. `outputs` must be non-null and
120// empty.
121Status CreateBody(const Scope& scope, const BodyGraphBuilderFn& body,
122 const std::vector<Output>& inputs,
123 std::vector<Output>* outputs) {
124 DCHECK(outputs != nullptr);
125 DCHECK(outputs->empty());
126
127 // The control dependency is analogous to that in CreateCond().
128 Scope body_scope =
129 scope.NewSubScope("body").WithControlDependencies(inputs[0]);
130 TF_RETURN_IF_ERROR(body(body_scope, inputs, outputs));
131
132 const size_t num_loop_vars = inputs.size();
133 if (outputs->size() != num_loop_vars) {
134 return errors::InvalidArgument(
135 "BuildWhileLoop: 'body' argument expected to return ", num_loop_vars,
136 " output(s), got ", outputs->size());
137 }
138 for (const Output& output : *outputs) {
139 TF_RETURN_IF_ERROR(
140 scope.graph()->IsValidOutputTensor(output.node(), output.index()));
141 // TODO(skyewm): check output types/shapes
142 }
143 return Status::OK();
144}
145
146} // namespace
147

Callers 1

BuildWhileLoopFunction · 0.85

Calls 10

InvalidArgumentFunction · 0.85
NewSubScopeMethod · 0.80
IsValidOutputTensorMethod · 0.80
bodyFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45
graphMethod · 0.45
nodeMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected