chromium/third_party/mediapipe/src/mediapipe/framework/validated_graph_config.cc

// Copyright 2019 The MediaPipe Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "mediapipe/framework/validated_graph_config.h"

#include <memory>
#include <string>

#include "absl/container/flat_hash_set.h"
#include "absl/log/absl_check.h"
#include "absl/log/absl_log.h"
#include "absl/memory/memory.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_join.h"
#include "absl/strings/substitute.h"
#include "mediapipe/framework/calculator.pb.h"
#include "mediapipe/framework/calculator_base.h"
#include "mediapipe/framework/graph_service_manager.h"
#include "mediapipe/framework/legacy_calculator_support.h"
#include "mediapipe/framework/packet_generator.h"
#include "mediapipe/framework/packet_generator.pb.h"
#include "mediapipe/framework/packet_set.h"
#include "mediapipe/framework/packet_type.h"
#include "mediapipe/framework/port.h"
#include "mediapipe/framework/port/core_proto_inc.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/proto_ns.h"
#include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/framework/port/source_location.h"
#include "mediapipe/framework/port/status.h"
#include "mediapipe/framework/port/status_builder.h"
#include "mediapipe/framework/port/topologicalsorter.h"
#include "mediapipe/framework/status_handler.h"
#include "mediapipe/framework/stream_handler.pb.h"
#include "mediapipe/framework/thread_pool_executor.pb.h"
#include "mediapipe/framework/tool/name_util.h"
#include "mediapipe/framework/tool/status_util.h"
#include "mediapipe/framework/tool/subgraph_expansion.h"
#include "mediapipe/framework/tool/validate.h"
#include "mediapipe/framework/tool/validate_name.h"

namespace mediapipe {

// Create a debug string name for a set of edge.  An edge can be either
// a stream or a side packet.
std::string DebugEdgeNames(
    const std::string& edge_type,
    const proto_ns::RepeatedPtrField<ProtoString>& edges) {}

// TODO Shorten the debug name to identify the node with minimal
// information.
std::string DebugName(const CalculatorGraphConfig::Node& node_config) {}

namespace {

std::string DebugName(const PacketGeneratorConfig& node_config) {}

std::string DebugName(const StatusHandlerConfig& node_config) {}

std::string DebugName(const CalculatorGraphConfig& config,
                      NodeTypeInfo::NodeType node_type, int node_index) {}

// Adds the ExecutorConfigs for predefined executors, if they are not in
// graph_config.
//
// Converts the graph-level num_threads field to an ExecutorConfig for the
// default executor with the executor type unspecified.
absl::Status AddPredefinedExecutorConfigs(CalculatorGraphConfig* graph_config) {}

}  // namespace

// static
std::string NodeTypeInfo::NodeTypeToString(NodeType node_type) {}

absl::Status NodeTypeInfo::Initialize(
    const ValidatedGraphConfig& validated_graph,
    const CalculatorGraphConfig::Node& node, int node_index) {}

absl::Status NodeTypeInfo::Initialize(
    const ValidatedGraphConfig& validated_graph,
    const PacketGeneratorConfig& node, int node_index) {}

absl::Status NodeTypeInfo::Initialize(
    const ValidatedGraphConfig& validated_graph,
    const StatusHandlerConfig& node, int node_index) {}

absl::Status ValidatedGraphConfig::Initialize(
    CalculatorGraphConfig input_config, const GraphRegistry* graph_registry,
    const Subgraph::SubgraphOptions* graph_options,
    std::shared_ptr<GraphServiceManager> service_manager) {}

absl::Status ValidatedGraphConfig::Initialize(
    const std::string& graph_type, const GraphRegistry* graph_registry,
    const Subgraph::SubgraphOptions* graph_options,
    std::shared_ptr<GraphServiceManager> service_manager) {}

absl::Status ValidatedGraphConfig::Initialize(
    const std::vector<CalculatorGraphConfig>& input_configs,
    const std::vector<CalculatorGraphTemplate>& input_templates,
    const std::string& graph_type,
    const Subgraph::SubgraphOptions* graph_options,
    std::shared_ptr<GraphServiceManager> service_manager) {}

absl::Status ValidatedGraphConfig::PerformBasicTransforms(
    const GraphRegistry* graph_registry,
    const Subgraph::SubgraphOptions* graph_options,
    std::shared_ptr<GraphServiceManager> service_manager) {}

absl::Status ValidatedGraphConfig::InitializeCalculatorInfo() {}

absl::Status ValidatedGraphConfig::InitializeGeneratorInfo() {}

absl::Status ValidatedGraphConfig::InitializeStatusHandlerInfo() {}

absl::Status ValidatedGraphConfig::InitializeSidePacketInfo(
    bool* need_sorting_ptr) {}

absl::Status ValidatedGraphConfig::AddInputSidePacketsForNode(
    NodeTypeInfo* node_type_info) {}

absl::Status ValidatedGraphConfig::AddOutputSidePacketsForNode(
    NodeTypeInfo* node_type_info, bool* need_sorting_ptr) {}

absl::Status ValidatedGraphConfig::InitializeStreamInfo(
    bool* need_sorting_ptr) {}

absl::Status ValidatedGraphConfig::AddOutputStreamsForNode(
    NodeTypeInfo* node_type_info) {}

absl::Status ValidatedGraphConfig::AddOutputStream(NodeTypeInfo::NodeRef node,
                                                   const std::string& name,
                                                   PacketType* packet_type) {}

absl::Status ValidatedGraphConfig::AddInputStreamsForNode(
    NodeTypeInfo* node_type_info, bool* need_sorting_ptr) {}

int ValidatedGraphConfig::SorterIndexForNode(NodeTypeInfo::NodeRef node) const {}

NodeTypeInfo::NodeRef ValidatedGraphConfig::NodeForSorterIndex(
    int index) const {}

absl::Status ValidatedGraphConfig::TopologicalSortNodes() {}

absl::Status ValidatedGraphConfig::FillUpstreamFieldForBackEdges() {}

absl::Status ValidatedGraphConfig::ValidateSidePacketTypes() {}

absl::Status ValidatedGraphConfig::ResolveAnyTypes(
    std::vector<EdgeInfo>* input_edges, std::vector<EdgeInfo>* output_edges) {}

absl::Status ValidatedGraphConfig::ResolveOneOfTypes(
    std::vector<EdgeInfo>* input_edges, std::vector<EdgeInfo>* output_edges) {}

absl::Status ValidatedGraphConfig::ValidateStreamTypes() {}

absl::Status ValidatedGraphConfig::ValidateExecutors() {}

// static
bool ValidatedGraphConfig::IsReservedExecutorName(const std::string& name) {}

absl::Status ValidatedGraphConfig::ValidateRequiredSidePackets(
    const std::map<std::string, Packet>& side_packets) const {}

absl::Status ValidatedGraphConfig::ValidateRequiredSidePacketTypes(
    const std::map<std::string, PacketType>& side_packet_types) const {}

absl::Status ValidatedGraphConfig::ComputeSourceDependence() {}

absl::StatusOr<std::string> ValidatedGraphConfig::RegisteredSidePacketTypeName(
    const std::string& name) {}

absl::StatusOr<std::string> ValidatedGraphConfig::RegisteredStreamTypeName(
    const std::string& name) {}

}  // namespace mediapipe