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

Function UpdateEdge

tensorflow/c/python_api.cc:58–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58void UpdateEdge(TF_Graph* graph, TF_Output new_src, TF_Input dst,
59 TF_Status* status) {
60 mutex_lock l(graph->mu);
61 tensorflow::shape_inference::InferenceContext* ic =
62 graph->refiner.GetContext(&new_src.oper->node);
63
64 if (ic->num_outputs() <= new_src.index) {
65 status->status = tensorflow::errors::OutOfRange(
66 "Cannot update edge. Output index [", new_src.index,
67 "] is greater than the number of total outputs [", ic->num_outputs(),
68 "].");
69 return;
70 }
71 tensorflow::shape_inference::ShapeHandle shape = ic->output(new_src.index);
72
73 tensorflow::shape_inference::InferenceContext* ic_dst =
74 graph->refiner.GetContext(&dst.oper->node);
75 if (ic_dst->num_inputs() <= dst.index) {
76 status->status = tensorflow::errors::OutOfRange(
77 "Cannot update edge. Input index [", dst.index,
78 "] is greater than the number of total inputs [", ic_dst->num_inputs(),
79 "].");
80 return;
81 }
82 if (!ic_dst->MergeInput(dst.index, shape)) {
83 status->status = tensorflow::errors::InvalidArgument(
84 "Cannot update edge, incompatible shapes: ", ic_dst->DebugString(shape),
85 " and ", ic_dst->DebugString(ic_dst->input(dst.index)), ".");
86 return;
87 }
88 status->status = graph->graph.UpdateEdge(&new_src.oper->node, new_src.index,
89 &dst.oper->node, dst.index);
90
91 if (TF_GetCode(status) == TF_OK) {
92 // This modification only updates the destination node for
93 // the purposes of running this graph in a session. Thus, we don't
94 // record the source node as being modified.
95 RecordMutation(graph, *dst.oper, "updating input tensor");
96 }
97}
98
99void RemoveAllControlInputs(TF_Graph* graph, TF_Operation* op) {
100 mutex_lock l(graph->mu);

Callers 2

Calls 11

InvalidArgumentFunction · 0.85
TF_GetCodeFunction · 0.85
RecordMutationFunction · 0.85
MergeInputMethod · 0.80
outputMethod · 0.65
GetContextMethod · 0.45
num_outputsMethod · 0.45
num_inputsMethod · 0.45
DebugStringMethod · 0.45
inputMethod · 0.45
UpdateEdgeMethod · 0.45

Tested by

no test coverage detected