From 837225c53d55700ff485367bb0fa71890f905e2e Mon Sep 17 00:00:00 2001 From: MediaPipe Team Date: Tue, 22 Nov 2022 17:30:23 -0800 Subject: [PATCH] Internal change PiperOrigin-RevId: 490374976 --- mediapipe/framework/validated_graph_config.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mediapipe/framework/validated_graph_config.cc b/mediapipe/framework/validated_graph_config.cc index 16aad6e9b..01e3da83e 100644 --- a/mediapipe/framework/validated_graph_config.cc +++ b/mediapipe/framework/validated_graph_config.cc @@ -1048,6 +1048,14 @@ absl::Status ValidatedGraphConfig::ValidateRequiredSidePacketTypes( for (const auto& required_item : required_side_packets_) { auto iter = side_packet_types.find(required_item.first); if (iter == side_packet_types.end()) { + bool is_optional = true; + for (int index : required_item.second) { + is_optional &= input_side_packets_[index].packet_type->IsOptional(); + } + if (is_optional) { + // Side packets that are optional and not provided are ignored. + continue; + } statuses.push_back(mediapipe::InvalidArgumentErrorBuilder(MEDIAPIPE_LOC) << "Side packet \"" << required_item.first << "\" is required but was not provided.");