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

Function ConstructOp

tensorflow/core/graph/star_server_graph_partition_test.cc:89–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87.SetShapeFn(shape_inference::ScalarShape);
88
89Output ConstructOp(const Scope& scope, const string& op_type,
90 const string &device,
91 const gtl::ArraySlice<Input>& inputs,
92 const gtl::ArraySlice<Node*>& control_inputs = {}) {
93
94 if (op_type == "VariableV2") {
95 auto v = ops::Variable(scope, {}, DT_FLOAT);
96 v.node()->set_assigned_device_name(device);
97 return v;
98 }
99 if (!scope.ok()) {
100 return Output();
101 }
102 const string unique_name = scope.GetUniqueNameForOp(op_type);
103 auto builder =
104 NodeBuilder(unique_name, op_type, scope.graph()->op_registry());
105 builder.Device(device);
106 for (auto const& input : inputs) {
107 builder.Input(ops::NodeOut(input.node(), input.index()));
108 }
109 if (!control_inputs.empty()) {
110 builder.ControlInputs(control_inputs);
111 }
112 scope.UpdateBuilder(&builder);
113 Node* ret;
114 scope.UpdateStatus(builder.Finalize(scope.graph(), &ret));
115 if (!scope.ok()) {
116 return Output();
117 }
118 scope.UpdateStatus(scope.DoShapeInference(ret));
119 return Output(ret);
120}
121
122Output FloatInput(const Scope& scope, const string &device) {
123 return ConstructOp(scope, "FloatInput", device, {});

Callers 4

FloatInputFunction · 0.70
BoolInputFunction · 0.70
CombineFunction · 0.70
TEST_FFunction · 0.70

Calls 15

GetUniqueNameForOpMethod · 0.80
UpdateBuilderMethod · 0.80
DoShapeInferenceMethod · 0.80
NodeBuilderClass · 0.70
NodeOutClass · 0.70
VariableClass · 0.50
OutputClass · 0.50
nodeMethod · 0.45
okMethod · 0.45
op_registryMethod · 0.45
graphMethod · 0.45

Tested by

no test coverage detected