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

Function CreateSwitchN

tensorflow/compiler/jit/deadness_analysis_test.cc:1224–1244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1222}
1223
1224void CreateSwitchN(const Scope& scope, Input data, Input output_index,
1225 int64 num_outs, OutputList* outputs) {
1226 if (!scope.ok()) return;
1227 auto _data = ops::AsNodeOut(scope, data);
1228 if (!scope.ok()) return;
1229 auto _output_index = ops::AsNodeOut(scope, output_index);
1230 if (!scope.ok()) return;
1231 Node* ret;
1232 const auto unique_name = scope.GetUniqueNameForOp("_SwitchN");
1233 auto builder = NodeBuilder(unique_name, "_SwitchN")
1234 .Input(_data)
1235 .Input(_output_index)
1236 .Attr("num_outs", num_outs);
1237 scope.UpdateBuilder(&builder);
1238 scope.UpdateStatus(builder.Finalize(scope.graph(), &ret));
1239 if (!scope.ok()) return;
1240 scope.UpdateStatus(scope.DoShapeInference(ret));
1241 for (int32 i = 0; i < ret->num_outputs(); ++i) {
1242 outputs->push_back(Output(ret, i));
1243 }
1244}
1245
1246TEST(DeadnessAnalysisTest, Constant1_SwitchN_2Branches_DoesNotFail) {
1247 Scope root = Scope::NewRootScope().ExitOnError();

Callers 1

TESTFunction · 0.85

Calls 14

AsNodeOutFunction · 0.85
GetUniqueNameForOpMethod · 0.80
UpdateBuilderMethod · 0.80
DoShapeInferenceMethod · 0.80
NodeBuilderClass · 0.50
OutputClass · 0.50
okMethod · 0.45
AttrMethod · 0.45
InputMethod · 0.45
UpdateStatusMethod · 0.45
FinalizeMethod · 0.45
graphMethod · 0.45

Tested by

no test coverage detected