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

Method Init

tensorflow/c/while_loop_test.cc:36–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34 }
35
36 void Init(int ninputs) {
37 DCHECK(inputs_.empty());
38 DCHECK_GT(ninputs, 0);
39
40 for (int i = 0; i < ninputs; ++i) {
41 TF_Operation* placeholder = Placeholder(
42 graph_, s_, ::tensorflow::strings::StrCat("p", i).c_str());
43 DCHECK_EQ(TF_OK, TF_GetCode(s_)) << TF_Message(s_);
44 inputs_.push_back({placeholder, 0});
45 }
46
47 original_graph_description_ = GraphDebugString();
48
49 params_.reset(new TF_WhileParams(
50 TF_NewWhile(graph_, &inputs_[0], inputs_.size(), s_)));
51 ASSERT_EQ(TF_OK, TF_GetCode(s_)) << TF_Message(s_);
52 ASSERT_EQ(original_graph_description_, GraphDebugString())
53 << "TF_NewWhile() altered graph";
54
55 params_->name = "test_loop";
56
57 // Initialize outputs_ so we can easily detect errors/bugs
58 outputs_.resize(ninputs, {nullptr, -1});
59 }
60
61 void ExpectOK() {
62 TF_FinishWhile(params_.get(), s_, &outputs_[0]);

Callers

nothing calls this directly

Calls 11

TF_GetCodeFunction · 0.85
TF_MessageFunction · 0.85
TF_NewWhileFunction · 0.85
c_strMethod · 0.80
PlaceholderFunction · 0.70
StrCatFunction · 0.50
emptyMethod · 0.45
push_backMethod · 0.45
resetMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected