From e56fa8f258dbc32458e595ecca8043e7a8aeb893 Mon Sep 17 00:00:00 2001 From: MediaPipe Team Date: Wed, 18 Jan 2023 10:59:56 -0800 Subject: [PATCH] Source/SideSource -> Stream/SidePacket PiperOrigin-RevId: 502923931 --- mediapipe/framework/api2/builder_test.cc | 50 ++++++++++++------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/mediapipe/framework/api2/builder_test.cc b/mediapipe/framework/api2/builder_test.cc index b01c2b759..08f4f0ca1 100644 --- a/mediapipe/framework/api2/builder_test.cc +++ b/mediapipe/framework/api2/builder_test.cc @@ -53,20 +53,20 @@ TEST(BuilderTest, BuildGraph) { EXPECT_THAT(graph.GetConfig(), EqualsProto(expected)); } -TEST(BuilderTest, CopyableSource) { +TEST(BuilderTest, CopyableStream) { Graph graph; - Source a = graph.In("A").SetName("a").Cast(); - Source b = graph.In("B").SetName("b").Cast(); - SideSource side_a = + Stream a = graph.In("A").SetName("a").Cast(); + Stream b = graph.In("B").SetName("b").Cast(); + SidePacket side_a = graph.SideIn("SIDE_A").SetName("side_a").Cast(); - SideSource side_b = + SidePacket side_b = graph.SideIn("SIDE_B").SetName("side_b").Cast(); Destination out = graph.Out("OUT").Cast(); SideDestination side_out = graph.SideOut("SIDE_OUT").Cast(); - Source input = a; + Stream input = a; input = b; - SideSource side_input = side_b; + SidePacket side_input = side_b; side_input = side_a; input >> out; @@ -87,23 +87,23 @@ TEST(BuilderTest, CopyableSource) { TEST(BuilderTest, BuildGraphWithFunctions) { Graph graph; - Source base = graph.In("IN").SetName("base").Cast(); - SideSource side = graph.SideIn("SIDE").SetName("side").Cast(); + Stream base = graph.In("IN").SetName("base").Cast(); + SidePacket side = graph.SideIn("SIDE").SetName("side").Cast(); - auto foo_fn = [](Source base, SideSource side, Graph& graph) { + auto foo_fn = [](Stream base, SidePacket side, Graph& graph) { auto& foo = graph.AddNode("Foo"); base >> foo.In("BASE"); side >> foo.SideIn("SIDE"); return foo.Out("OUT")[0].Cast(); }; - Source foo_out = foo_fn(base, side, graph); + Stream foo_out = foo_fn(base, side, graph); - auto bar_fn = [](Source in, Graph& graph) { + auto bar_fn = [](Stream in, Graph& graph) { auto& bar = graph.AddNode("Bar"); in >> bar.In("IN"); return bar.Out("OUT")[0].Cast(); }; - Source bar_out = bar_fn(foo_out, graph); + Stream bar_out = bar_fn(foo_out, graph); bar_out.SetName("out") >> graph.Out("OUT"); @@ -375,26 +375,26 @@ class AnyAndSameTypeCalculator : public NodeIntf { TEST(BuilderTest, AnyAndSameTypeHandledProperly) { Graph graph; - Source any_input = graph.In("GRAPH_ANY_INPUT"); - Source int_input = graph.In("GRAPH_INT_INPUT").Cast(); + Stream any_input = graph.In("GRAPH_ANY_INPUT"); + Stream int_input = graph.In("GRAPH_INT_INPUT").Cast(); auto& node = graph.AddNode("AnyAndSameTypeCalculator"); any_input >> node[AnyAndSameTypeCalculator::kAnyTypeInput]; int_input >> node[AnyAndSameTypeCalculator::kIntInput]; - Source any_type_output = + Stream any_type_output = node[AnyAndSameTypeCalculator::kAnyTypeOutput]; any_type_output.SetName("any_type_output"); - Source same_type_output = + Stream same_type_output = node[AnyAndSameTypeCalculator::kSameTypeOutput]; same_type_output.SetName("same_type_output"); - Source recursive_same_type_output = + Stream recursive_same_type_output = node[AnyAndSameTypeCalculator::kRecursiveSameTypeOutput]; recursive_same_type_output.SetName("recursive_same_type_output"); - Source same_int_output = node[AnyAndSameTypeCalculator::kSameIntOutput]; + Stream same_int_output = node[AnyAndSameTypeCalculator::kSameIntOutput]; same_int_output.SetName("same_int_output"); - Source recursive_same_int_type_output = + Stream recursive_same_int_type_output = node[AnyAndSameTypeCalculator::kRecursiveSameIntOutput]; recursive_same_int_type_output.SetName("recursive_same_int_type_output"); @@ -418,12 +418,12 @@ TEST(BuilderTest, AnyAndSameTypeHandledProperly) { TEST(BuilderTest, AnyTypeCanBeCast) { Graph graph; - Source any_input = + Stream any_input = graph.In("GRAPH_ANY_INPUT").Cast(); auto& node = graph.AddNode("AnyAndSameTypeCalculator"); any_input >> node[AnyAndSameTypeCalculator::kAnyTypeInput]; - Source any_type_output = + Stream any_type_output = node[AnyAndSameTypeCalculator::kAnyTypeOutput] .SetName("any_type_output") .Cast(); @@ -462,7 +462,7 @@ TEST(BuilderTest, MultiPortIsCastToMultiPort) { TEST(BuilderTest, MultiPortCanBeSlicedToSinglePort) { Graph graph; MultiSource any_multi_input = graph.In("ANY_INPUT"); - Source any_input = any_multi_input; + Stream any_input = any_multi_input; MultiDestination any_multi_output = graph.Out("ANY_OUTPUT"); Destination any_output = any_multi_output; any_input >> any_output; @@ -477,8 +477,8 @@ TEST(BuilderTest, MultiPortCanBeSlicedToSinglePort) { TEST(BuilderTest, SinglePortAccessWorksThroughSlicing) { Graph graph; - Source int_input = graph.In("INT_INPUT").Cast(); - Source any_input = graph.In("ANY_OUTPUT"); + Stream int_input = graph.In("INT_INPUT").Cast(); + Stream any_input = graph.In("ANY_OUTPUT"); Destination int_output = graph.Out("INT_OUTPUT").Cast(); Destination any_output = graph.Out("ANY_OUTPUT"); int_input >> int_output;