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

Method input_edge

tensorflow/core/graph/graph.cc:259–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

257}
258
259Status Node::input_edge(int idx, const Edge** e) const {
260 if (idx < 0 || idx >= num_inputs()) {
261 return errors::InvalidArgument("Invalid input_edge index: ", idx, ", Node ",
262 name(), " only has ", num_inputs(),
263 " inputs.");
264 }
265
266 // This does a linear search over the edges. In the common case,
267 // the number of elements is small enough that this search isn't
268 // expensive. Should it become a bottleneck, one can make an
269 // optimization where, if the number of edges is small, we use
270 // linear iteration, and if the number of edges is large, we perform
271 // an indexing step during construction that keeps an array of Edges
272 // indexed by pointer. This would keep the size of each Node small
273 // in the common case but make this function faster when the number
274 // of edges is large.
275 for (const Edge* edge : in_edges()) {
276 if (edge->dst_input() == idx) {
277 *e = edge;
278 return Status::OK();
279 }
280 }
281
282 return errors::NotFound("Could not find input edge ", idx, " for ", name());
283}
284
285// Returns a vector of the non-control input edges to a node, indexed by ID.
286Status Node::input_edges(std::vector<const Edge*>* input_edges) const {

Callers 15

FunctionalizeLoopFunction · 0.80
GetSwitchPredicateFunction · 0.80
GetSwitchValueFunction · 0.80
BuildArgumentNodesMethod · 0.80
BuildIfNodeMethod · 0.80
RemoveRedundantSwitchMethod · 0.80
BackwardsConstAnalysisFunction · 0.80
ReorderOutputEdgesFunction · 0.80
CalculateRetvalRearrangeFunction · 0.80

Calls 4

InvalidArgumentFunction · 0.85
nameFunction · 0.85
NotFoundFunction · 0.85
dst_inputMethod · 0.45

Tested by 2

AddInputIdentityFunction · 0.64
TEST_FFunction · 0.64