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

Method LowerWhileHelper

tensorflow/core/common_runtime/lower_while_op.cc:156–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154};
155
156LowerWhileHelper::LowerWhileHelper(Node* while_op, const NameAttrList& cond_fn,
157 const NameAttrList& body_fn,
158 int parallel_iterations, Graph* graph,
159 bool keep_node_fetchable)
160 : while_op_(while_op),
161 graph_(graph),
162 name_(while_op->name()),
163 parallel_iterations_(parallel_iterations),
164 keep_node_fetchable_(keep_node_fetchable),
165 debug_info_(*while_op_),
166 cond_call_builder_(NewName("cond"), cond_fn.name(), graph->op_registry(),
167 &debug_info_),
168 body_call_builder_(NewName("body"), body_fn.name(), graph->op_registry(),
169 &debug_info_),
170 num_loop_inputs_(while_op_->num_inputs()) {
171 cond_call_builder_.Attr(kLowerAsMultiDeviceFunctionAttr, true);
172 for (const auto& i : cond_fn.attr()) {
173 cond_call_builder_.Attr(i.first, i.second);
174 }
175 body_call_builder_.Attr(kLowerAsMultiDeviceFunctionAttr, true);
176 for (const auto& i : body_fn.attr()) {
177 body_call_builder_.Attr(i.first, i.second);
178 }
179 // We intentionally `resize` instead of `reserve` space in `enter_nodes_`
180 // because we need to set it's elements out of order in `CreateEnterNodes`.
181 enter_nodes_.resize(num_loop_inputs_);
182 merge_nodes_.reserve(num_loop_inputs_);
183 switch_nodes_.reserve(num_loop_inputs_);
184 exit_nodes_.reserve(num_loop_inputs_);
185 next_iterations_nodes_.reserve(num_loop_inputs_);
186}
187
188Status LowerWhileHelper::RunInternal() {
189 TF_RETURN_IF_ERROR(CreateEnterNodes());

Callers

nothing calls this directly

Calls 8

NewNameFunction · 0.85
attrMethod · 0.80
nameMethod · 0.65
op_registryMethod · 0.45
num_inputsMethod · 0.45
AttrMethod · 0.45
resizeMethod · 0.45
reserveMethod · 0.45

Tested by

no test coverage detected