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

Method ListInput

tensorflow/core/framework/node_def_builder.cc:136–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136void NodeDefBuilder::ListInput(const OpDef::ArgDef* input_arg,
137 gtl::ArraySlice<NodeOut> src_list) {
138 for (const auto& node_out : src_list) {
139 AddInput(node_out.node, node_out.index);
140 }
141
142 if (!input_arg->number_attr().empty()) {
143 Attr(input_arg->number_attr(), static_cast<int64>(src_list.size()));
144 if (input_arg->type() != DT_INVALID) {
145 const DataType expected = MaybeAddRef(input_arg, input_arg->type());
146 for (const auto& node_out : src_list) {
147 VerifyInputType(input_arg, expected, node_out.data_type);
148 }
149 } else if (!src_list.empty()) {
150 const DataType base = BaseType(src_list[0].data_type);
151 Attr(input_arg->type_attr(), base);
152 const DataType expected = MaybeAddRef(input_arg, base);
153 for (const auto& node_out : src_list) {
154 VerifyInputType(input_arg, expected, node_out.data_type);
155 }
156 }
157 } else if (!input_arg->type_list_attr().empty()) {
158 DataTypeVector type_vec;
159 type_vec.reserve(src_list.size());
160 for (const auto& node_out : src_list) {
161 const DataType dt = node_out.data_type;
162 VerifyInputRef(input_arg, dt);
163 type_vec.push_back(BaseType(dt));
164 }
165 Attr(input_arg->type_list_attr(), type_vec);
166 } else {
167 errors_.push_back(strings::StrCat("List provided to input '",
168 input_arg->name(),
169 "' when single Tensor expected"));
170 }
171}
172
173void NodeDefBuilder::AddInput(StringPiece src_node, int src_index) {
174 if (src_node.empty()) {

Callers

nothing calls this directly

Calls 10

AttrFunction · 0.85
BaseTypeFunction · 0.85
typeMethod · 0.65
nameMethod · 0.65
AddInputFunction · 0.50
StrCatFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45
reserveMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected