Project import generated by Copybara.
GitOrigin-RevId: bb059a0721c92e8154d33ce8057b3915a25b3d7d
This commit is contained in:
@@ -1187,7 +1187,6 @@ cc_test(
|
||||
"//mediapipe/framework:calculator_cc_proto",
|
||||
"//mediapipe/framework/api2:node",
|
||||
"//mediapipe/framework/api2:port",
|
||||
"//mediapipe/framework/deps:message_matchers",
|
||||
"//mediapipe/framework/port:gtest_main",
|
||||
"@com_google_absl//absl/status",
|
||||
"@com_google_absl//absl/strings",
|
||||
@@ -1580,7 +1579,6 @@ cc_test(
|
||||
":packet",
|
||||
":packet_test_cc_proto",
|
||||
":type_map",
|
||||
"//mediapipe/framework/deps:message_matchers",
|
||||
"//mediapipe/framework/port:core_proto",
|
||||
"//mediapipe/framework/port:gtest_main",
|
||||
"@com_google_absl//absl/strings",
|
||||
@@ -1640,7 +1638,6 @@ cc_test(
|
||||
"//mediapipe/framework:calculator_cc_proto",
|
||||
"//mediapipe/framework:packet_generator_cc_proto",
|
||||
"//mediapipe/framework:status_handler_cc_proto",
|
||||
"//mediapipe/framework/deps:message_matchers",
|
||||
"//mediapipe/framework/port:gtest_main",
|
||||
"//mediapipe/framework/port:parse_text_proto",
|
||||
"//mediapipe/framework/tool:template_parser",
|
||||
|
||||
@@ -36,7 +36,6 @@ cc_test(
|
||||
":tag",
|
||||
":test_contracts",
|
||||
"//mediapipe/framework:calculator_framework",
|
||||
"//mediapipe/framework/deps:message_matchers",
|
||||
"//mediapipe/framework/port:gtest_main",
|
||||
"//mediapipe/framework/port:parse_text_proto",
|
||||
"@com_google_absl//absl/strings",
|
||||
@@ -175,7 +174,6 @@ cc_test(
|
||||
":port",
|
||||
":test_contracts",
|
||||
"//mediapipe/framework:calculator_framework",
|
||||
"//mediapipe/framework/deps:message_matchers",
|
||||
"//mediapipe/framework/port:gtest_main",
|
||||
"//mediapipe/framework/port:parse_text_proto",
|
||||
"//mediapipe/framework/tool:subgraph_expansion",
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "mediapipe/framework/api2/tag.h"
|
||||
#include "mediapipe/framework/api2/test_contracts.h"
|
||||
#include "mediapipe/framework/calculator_framework.h"
|
||||
#include "mediapipe/framework/deps/message_matchers.h"
|
||||
#include "mediapipe/framework/port/gmock.h"
|
||||
#include "mediapipe/framework/port/gtest.h"
|
||||
#include "mediapipe/framework/port/parse_text_proto.h"
|
||||
|
||||
@@ -565,6 +565,19 @@ TEST(NodeTest, ConsumeInputs) {
|
||||
MP_EXPECT_OK(graph.WaitUntilDone());
|
||||
}
|
||||
|
||||
// Just to test that single-port contracts work.
|
||||
struct LogSinkNode : public Node {
|
||||
static constexpr Input<int> kIn{"IN"};
|
||||
|
||||
MEDIAPIPE_NODE_CONTRACT(kIn);
|
||||
|
||||
absl::Status Process(CalculatorContext* cc) override {
|
||||
LOG(INFO) << "LogSinkNode received: " << kIn(cc).Get();
|
||||
return {};
|
||||
}
|
||||
};
|
||||
MEDIAPIPE_REGISTER_NODE(LogSinkNode);
|
||||
|
||||
} // namespace test
|
||||
} // namespace api2
|
||||
} // namespace mediapipe
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "mediapipe/framework/api2/port.h"
|
||||
#include "mediapipe/framework/api2/test_contracts.h"
|
||||
#include "mediapipe/framework/calculator_framework.h"
|
||||
#include "mediapipe/framework/deps/message_matchers.h"
|
||||
#include "mediapipe/framework/port/gmock.h"
|
||||
#include "mediapipe/framework/port/gtest.h"
|
||||
#include "mediapipe/framework/port/parse_text_proto.h"
|
||||
|
||||
@@ -18,11 +18,10 @@ template <class Tuple>
|
||||
using tuple_index_sequence =
|
||||
std::make_index_sequence<std::tuple_size_v<std::decay_t<Tuple>>>;
|
||||
|
||||
// Concatenates two std::index_sequences.
|
||||
template <std::size_t... I, std::size_t... J>
|
||||
constexpr auto index_sequence_cat(std::index_sequence<I...>,
|
||||
std::index_sequence<J...>)
|
||||
-> std::index_sequence<I..., J...> {
|
||||
// Concatenates multiple std::index_sequences.
|
||||
template <std::size_t... I>
|
||||
constexpr auto index_sequence_cat(std::index_sequence<I...>)
|
||||
-> std::index_sequence<I...> {
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ TEST(CalculatorTest, CreateByName) {
|
||||
TEST(CalculatorTest, CreateByNameWhitelisted) {
|
||||
// Reset the registration namespace whitelist.
|
||||
*const_cast<absl::flat_hash_set<std::string>*>(
|
||||
&NamespaceWhitelist::TopNamespaces()) = absl::flat_hash_set<std::string>{
|
||||
&NamespaceAllowlist::TopNamespaces()) = absl::flat_hash_set<std::string>{
|
||||
"mediapipe::test_ns::whitelisted_ns",
|
||||
"mediapipe",
|
||||
};
|
||||
|
||||
@@ -236,21 +236,21 @@ class CalculatorNode {
|
||||
}
|
||||
|
||||
private:
|
||||
// Sets up the output side packets from the master flat array.
|
||||
// Sets up the output side packets from the main flat array.
|
||||
absl::Status InitializeOutputSidePackets(
|
||||
const PacketTypeSet& output_side_packet_types,
|
||||
OutputSidePacketImpl* output_side_packets);
|
||||
// Connects the input side packets as mirrors on the output side packets.
|
||||
// Output side packets are looked up in the master flat array which is
|
||||
// Output side packets are looked up in the main flat array which is
|
||||
// provided.
|
||||
absl::Status InitializeInputSidePackets(
|
||||
OutputSidePacketImpl* output_side_packets);
|
||||
// Sets up the output streams from the master flat array.
|
||||
// Sets up the output streams from the main flat array.
|
||||
absl::Status InitializeOutputStreams(
|
||||
OutputStreamManager* output_stream_managers);
|
||||
// Sets up the input streams and connects them as mirrors on the
|
||||
// output streams. Both input streams and output streams are looked
|
||||
// up in the master flat arrays which are provided.
|
||||
// up in the main flat arrays which are provided.
|
||||
absl::Status InitializeInputStreams(
|
||||
InputStreamManager* input_stream_managers,
|
||||
OutputStreamManager* output_stream_managers);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "absl/base/macros.h"
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "mediapipe/framework/collection_item_id.h"
|
||||
#include "mediapipe/framework/port/logging.h"
|
||||
#include "mediapipe/framework/tool/tag_map.h"
|
||||
@@ -50,7 +51,7 @@ struct CollectionErrorHandlerFatal {
|
||||
// Since there isn't any state and we're not returning anything, we
|
||||
// get away with only one version of this function (which is const
|
||||
// but returns a non-const reference).
|
||||
T& GetFallback(const std::string& tag, int index) const {
|
||||
T& GetFallback(const absl::string_view tag, int index) const {
|
||||
LOG(FATAL) << "Failed to get tag \"" << tag << "\" index " << index;
|
||||
std::abort();
|
||||
}
|
||||
@@ -131,16 +132,16 @@ class Collection {
|
||||
const value_type& Get(CollectionItemId id) const;
|
||||
|
||||
// Convenience functions.
|
||||
value_type& Get(const std::string& tag, int index);
|
||||
const value_type& Get(const std::string& tag, int index) const;
|
||||
value_type& Get(absl::string_view tag, int index);
|
||||
const value_type& Get(absl::string_view tag, int index) const;
|
||||
|
||||
// Equivalent to Get("", index);
|
||||
value_type& Index(int index);
|
||||
const value_type& Index(int index) const;
|
||||
|
||||
// Equivalent to Get(tag, 0);
|
||||
value_type& Tag(const std::string& tag);
|
||||
const value_type& Tag(const std::string& tag) const;
|
||||
value_type& Tag(absl::string_view tag);
|
||||
const value_type& Tag(absl::string_view tag) const;
|
||||
|
||||
// These functions only exist for collections with storage ==
|
||||
// kStorePointer. GetPtr returns the stored ptr value rather than
|
||||
@@ -179,13 +180,15 @@ class Collection {
|
||||
////////////////////////////////////////
|
||||
|
||||
// Returns true if the provided tag is available (not necessarily set yet).
|
||||
bool HasTag(const std::string& tag) const { return tag_map_->HasTag(tag); }
|
||||
bool HasTag(const absl::string_view tag) const {
|
||||
return tag_map_->HasTag(tag);
|
||||
}
|
||||
|
||||
// Returns the number of entries in this collection.
|
||||
int NumEntries() const { return tag_map_->NumEntries(); }
|
||||
|
||||
// Returns the number of entries with the provided tag.
|
||||
int NumEntries(const std::string& tag) const {
|
||||
int NumEntries(const absl::string_view tag) const {
|
||||
return tag_map_->NumEntries(tag);
|
||||
}
|
||||
|
||||
@@ -200,7 +203,7 @@ class Collection {
|
||||
// However, be careful in using this fact, as it circumvents the
|
||||
// validity checks in GetId() (i.e. ++GetId("BLAH", 2) looks like it
|
||||
// is valid, while GetId("BLAH", 3) is not valid).
|
||||
CollectionItemId GetId(const std::string& tag, int index) const {
|
||||
CollectionItemId GetId(const absl::string_view tag, int index) const {
|
||||
return tag_map_->GetId(tag, index);
|
||||
}
|
||||
|
||||
@@ -234,10 +237,10 @@ class Collection {
|
||||
// for (CollectionItemId id = collection.BeginId(tag);
|
||||
// id < collection.EndId(tag); ++id) {
|
||||
// }
|
||||
CollectionItemId BeginId(const std::string& tag) const {
|
||||
CollectionItemId BeginId(const absl::string_view tag) const {
|
||||
return tag_map_->BeginId(tag);
|
||||
}
|
||||
CollectionItemId EndId(const std::string& tag) const {
|
||||
CollectionItemId EndId(const absl::string_view tag) const {
|
||||
return tag_map_->EndId(tag);
|
||||
}
|
||||
|
||||
@@ -404,7 +407,7 @@ bool Collection<T, storage, ErrorHandler>::UsesTags() const {
|
||||
return false;
|
||||
}
|
||||
// If the one tag present is non-empty then we are using tags.
|
||||
return mapping.begin()->first != "";
|
||||
return !mapping.begin()->first.empty();
|
||||
}
|
||||
|
||||
template <typename T, CollectionStorage storage, typename ErrorHandler>
|
||||
@@ -449,7 +452,8 @@ Collection<T, storage, ErrorHandler>::GetPtr(CollectionItemId id) const {
|
||||
|
||||
template <typename T, CollectionStorage storage, typename ErrorHandler>
|
||||
typename Collection<T, storage, ErrorHandler>::value_type&
|
||||
Collection<T, storage, ErrorHandler>::Get(const std::string& tag, int index) {
|
||||
Collection<T, storage, ErrorHandler>::Get(const absl::string_view tag,
|
||||
int index) {
|
||||
CollectionItemId id = GetId(tag, index);
|
||||
if (!id.IsValid()) {
|
||||
return error_handler_.GetFallback(tag, index);
|
||||
@@ -459,7 +463,7 @@ Collection<T, storage, ErrorHandler>::Get(const std::string& tag, int index) {
|
||||
|
||||
template <typename T, CollectionStorage storage, typename ErrorHandler>
|
||||
const typename Collection<T, storage, ErrorHandler>::value_type&
|
||||
Collection<T, storage, ErrorHandler>::Get(const std::string& tag,
|
||||
Collection<T, storage, ErrorHandler>::Get(const absl::string_view tag,
|
||||
int index) const {
|
||||
CollectionItemId id = GetId(tag, index);
|
||||
if (!id.IsValid()) {
|
||||
@@ -482,13 +486,13 @@ Collection<T, storage, ErrorHandler>::Index(int index) const {
|
||||
|
||||
template <typename T, CollectionStorage storage, typename ErrorHandler>
|
||||
typename Collection<T, storage, ErrorHandler>::value_type&
|
||||
Collection<T, storage, ErrorHandler>::Tag(const std::string& tag) {
|
||||
Collection<T, storage, ErrorHandler>::Tag(const absl::string_view tag) {
|
||||
return Get(tag, 0);
|
||||
}
|
||||
|
||||
template <typename T, CollectionStorage storage, typename ErrorHandler>
|
||||
const typename Collection<T, storage, ErrorHandler>::value_type&
|
||||
Collection<T, storage, ErrorHandler>::Tag(const std::string& tag) const {
|
||||
Collection<T, storage, ErrorHandler>::Tag(const absl::string_view tag) const {
|
||||
return Get(tag, 0);
|
||||
}
|
||||
|
||||
@@ -535,21 +539,23 @@ Collection<T, storage, ErrorHandler>::end() const {
|
||||
// Returns c.HasTag(tag) && !Tag(tag)->IsEmpty() (just for convenience).
|
||||
// This version is used with Calculator.
|
||||
template <class S>
|
||||
bool HasTagValue(const internal::Collection<S*>& c, const std::string& tag) {
|
||||
bool HasTagValue(const internal::Collection<S*>& c,
|
||||
const absl::string_view tag) {
|
||||
return c.HasTag(tag) && !c.Tag(tag)->IsEmpty();
|
||||
}
|
||||
|
||||
// Returns c.HasTag(tag) && !Tag(tag).IsEmpty() (just for convenience).
|
||||
// This version is used with CalculatorBase.
|
||||
template <class S>
|
||||
bool HasTagValue(const internal::Collection<S>& c, const std::string& tag) {
|
||||
bool HasTagValue(const internal::Collection<S>& c,
|
||||
const absl::string_view tag) {
|
||||
return c.HasTag(tag) && !c.Tag(tag).IsEmpty();
|
||||
}
|
||||
|
||||
// Returns c.HasTag(tag) && !Tag(tag).IsEmpty() (just for convenience).
|
||||
// This version is used with Calculator or CalculatorBase.
|
||||
template <class C>
|
||||
bool HasTagValue(const C& c, const std::string& tag) {
|
||||
bool HasTagValue(const C& c, const absl::string_view tag) {
|
||||
return HasTagValue(c->Inputs(), tag);
|
||||
}
|
||||
|
||||
|
||||
@@ -87,10 +87,11 @@ cc_library(
|
||||
name = "message_matchers",
|
||||
testonly = True,
|
||||
hdrs = ["message_matchers.h"],
|
||||
visibility = ["//visibility:public"],
|
||||
# Use this library through "mediapipe/framework/port:gtest_main".
|
||||
visibility = ["//mediapipe/framework/port:__pkg__"],
|
||||
deps = [
|
||||
"//mediapipe/framework/port:core_proto",
|
||||
"//mediapipe/framework/port:gtest_main",
|
||||
"@com_google_googletest//:gtest",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
#include "mediapipe/framework/port/core_proto_inc.h"
|
||||
#include "mediapipe/framework/port/gmock.h"
|
||||
|
||||
namespace mediapipe {
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace mediapipe {
|
||||
namespace {
|
||||
|
||||
// List of namespaces that can register calculators inside the namespace
|
||||
// and still refer to them using an unqualified name. This whitelist
|
||||
// and still refer to them using an unqualified name. This allowlist
|
||||
// is meant to facilitate migration from unqualified to fully qualified
|
||||
// calculator names.
|
||||
constexpr char const* kTopNamespaces[] = {
|
||||
@@ -36,7 +36,7 @@ inline size_t array_size(T (&arr)[SIZE]) {
|
||||
} // namespace
|
||||
|
||||
/*static*/
|
||||
const absl::flat_hash_set<std::string>& NamespaceWhitelist::TopNamespaces() {
|
||||
const absl::flat_hash_set<std::string>& NamespaceAllowlist::TopNamespaces() {
|
||||
static absl::flat_hash_set<std::string>* result =
|
||||
new absl::flat_hash_set<std::string>(
|
||||
kTopNamespaces, kTopNamespaces + array_size(kTopNamespaces));
|
||||
|
||||
@@ -144,7 +144,7 @@ struct WrapStatusOr<absl::StatusOr<T>> {
|
||||
};
|
||||
} // namespace registration_internal
|
||||
|
||||
class NamespaceWhitelist {
|
||||
class NamespaceAllowlist {
|
||||
public:
|
||||
static const absl::flat_hash_set<std::string>& TopNamespaces();
|
||||
};
|
||||
@@ -289,14 +289,14 @@ class FunctionRegistry {
|
||||
mutable absl::Mutex lock_;
|
||||
std::unordered_map<std::string, Function> functions_ ABSL_GUARDED_BY(lock_);
|
||||
|
||||
// For names included in NamespaceWhitelist, strips the namespace.
|
||||
// For names included in NamespaceAllowlist, strips the namespace.
|
||||
std::string GetAdjustedName(const std::string& name) {
|
||||
constexpr auto kCxxSep = registration_internal::kCxxSep;
|
||||
std::vector<std::string> names = absl::StrSplit(name, kCxxSep);
|
||||
std::string base_name = names.back();
|
||||
names.pop_back();
|
||||
std::string ns = absl::StrJoin(names, kCxxSep);
|
||||
if (NamespaceWhitelist::TopNamespaces().count(ns)) {
|
||||
if (NamespaceAllowlist::TopNamespaces().count(ns)) {
|
||||
return base_name;
|
||||
}
|
||||
return name;
|
||||
|
||||
@@ -242,7 +242,7 @@ bool ImageFrame::IsValidAlignmentNumber(uint32 alignment_boundary) {
|
||||
|
||||
// static
|
||||
std::string ImageFrame::InvalidFormatString(ImageFormat::Format format) {
|
||||
#ifdef MEDIAPIPE_MOBILE
|
||||
#ifdef MEDIAPIPE_PROTO_LITE
|
||||
return "Invalid format.";
|
||||
#else
|
||||
const proto_ns::EnumValueDescriptor* enum_value_descriptor =
|
||||
|
||||
@@ -75,7 +75,6 @@ int GetMatType(const mediapipe::ImageFormat::Format format) {
|
||||
} // namespace
|
||||
|
||||
namespace mediapipe {
|
||||
|
||||
namespace formats {
|
||||
|
||||
cv::Mat MatView(const ImageFrame* image) {
|
||||
|
||||
@@ -75,7 +75,6 @@ int GetMatType(const mediapipe::ImageFormat::Format format) {
|
||||
}
|
||||
} // namespace
|
||||
namespace mediapipe {
|
||||
|
||||
namespace formats {
|
||||
|
||||
cv::Mat MatView(const mediapipe::Image* image) {
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
// Copyright 2021 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.
|
||||
|
||||
#ifndef MEDIAPIPE_FRAMEWORK_FORMATS_TENSOR_INTERNAL_H_
|
||||
#define MEDIAPIPE_FRAMEWORK_FORMATS_TENSOR_INTERNAL_H_
|
||||
|
||||
@@ -6,7 +20,7 @@
|
||||
namespace mediapipe {
|
||||
|
||||
// Generates unique view id at compile-time using FILE and LINE.
|
||||
#define TENSOR_UNIQUE_VIEW_ID() \
|
||||
#define TENSOR_UNIQUE_VIEW_TYPE_ID() \
|
||||
static constexpr uint64_t kId = tensor_internal::FnvHash64( \
|
||||
__FILE__, tensor_internal::FnvHash64(TENSOR_INT_TO_STRING(__LINE__)))
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <functional>
|
||||
|
||||
#include "mediapipe/framework/calculator_framework.h"
|
||||
#include "mediapipe/framework/deps/message_matchers.h"
|
||||
#include "mediapipe/framework/port/gmock.h"
|
||||
#include "mediapipe/framework/port/gtest.h"
|
||||
#include "mediapipe/framework/port/parse_text_proto.h"
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "mediapipe/framework/port/ret_check.h"
|
||||
|
||||
namespace mediapipe {
|
||||
|
||||
using SyncSet = InputStreamHandler::SyncSet;
|
||||
|
||||
absl::Status InputStreamHandler::InitializeInputStreamManagers(
|
||||
|
||||
@@ -82,7 +82,7 @@ class InputStreamHandler {
|
||||
// flat_input_stream_managers is expected to point to a contiguous
|
||||
// flat array with InputStreamManagers corresponding to the id's in
|
||||
// InputStreamHandler::input_stream_managers_ (meaning it should point
|
||||
// to somewhere in the middle of the master flat array of all input
|
||||
// to somewhere in the middle of the main flat array of all input
|
||||
// stream managers).
|
||||
absl::Status InitializeInputStreamManagers(
|
||||
InputStreamManager* flat_input_stream_managers);
|
||||
|
||||
@@ -74,7 +74,7 @@ class OutputStreamHandler {
|
||||
// flat_output_stream_managers is expected to point to a contiguous
|
||||
// flat array with OutputStreamManagers corresponding to the id's in
|
||||
// OutputStreamHandler::output_stream_managers_ (meaning it should
|
||||
// point to somewhere in the middle of the master flat array of all
|
||||
// point to somewhere in the middle of the main flat array of all
|
||||
// output stream managers).
|
||||
absl::Status InitializeOutputStreamManagers(
|
||||
OutputStreamManager* flat_output_stream_managers);
|
||||
|
||||
@@ -363,13 +363,8 @@ class HolderBase {
|
||||
HolderBase& operator=(const HolderBase&) = delete;
|
||||
virtual ~HolderBase();
|
||||
template <typename T>
|
||||
void SetHolderTypeId() {
|
||||
type_id_ = tool::GetTypeHash<T>();
|
||||
}
|
||||
size_t GetHolderTypeId() const { return type_id_; }
|
||||
template <typename T>
|
||||
bool HolderIsOfType() const {
|
||||
return type_id_ == tool::GetTypeHash<T>();
|
||||
bool PayloadIsOfType() const {
|
||||
return GetTypeId() == tool::GetTypeHash<T>();
|
||||
}
|
||||
// Returns a printable std::string identifying the type stored in the holder.
|
||||
virtual const std::string DebugTypeName() const = 0;
|
||||
@@ -397,8 +392,7 @@ class HolderBase {
|
||||
virtual StatusOr<std::vector<const proto_ns::MessageLite*>>
|
||||
GetVectorOfProtoMessageLite() const = 0;
|
||||
|
||||
private:
|
||||
size_t type_id_;
|
||||
virtual bool HasForeignOwner() const { return false; }
|
||||
};
|
||||
|
||||
// Two helper functions to get the proto base pointers.
|
||||
@@ -505,7 +499,6 @@ class Holder : public HolderBase {
|
||||
public:
|
||||
explicit Holder(const T* ptr) : ptr_(ptr) {
|
||||
HolderSupport<T>::EnsureStaticInit();
|
||||
SetHolderTypeId<Holder>();
|
||||
}
|
||||
~Holder() override { delete_helper(); }
|
||||
const T& data() const {
|
||||
@@ -521,9 +514,7 @@ class Holder : public HolderBase {
|
||||
absl::StatusOr<std::unique_ptr<T>> Release(
|
||||
typename std::enable_if<!std::is_array<U>::value ||
|
||||
std::extent<U>::value != 0>::type* = 0) {
|
||||
// Since C++ doesn't allow virtual, templated functions, check holder
|
||||
// type here to make sure it's not upcasted from a ForeignHolder.
|
||||
if (!HolderIsOfType<Holder<T>>()) {
|
||||
if (HasForeignOwner()) {
|
||||
return InternalError(
|
||||
"Foreign holder can't release data ptr without ownership.");
|
||||
}
|
||||
@@ -592,25 +583,19 @@ class Holder : public HolderBase {
|
||||
template <typename T>
|
||||
class ForeignHolder : public Holder<T> {
|
||||
public:
|
||||
explicit ForeignHolder(const T* ptr) : Holder<T>(ptr) {
|
||||
// Distinguishes between Holder and ForeignHolder since Consume() treats
|
||||
// them differently.
|
||||
this->template SetHolderTypeId<ForeignHolder>();
|
||||
}
|
||||
using Holder<T>::Holder;
|
||||
~ForeignHolder() override {
|
||||
// Null out ptr_ so it doesn't get deleted by ~Holder.
|
||||
// Note that ~Holder cannot call HasForeignOwner because the subclass's
|
||||
// destructor runs first.
|
||||
this->ptr_ = nullptr;
|
||||
}
|
||||
// Foreign holder can't release data pointer without ownership.
|
||||
absl::StatusOr<std::unique_ptr<T>> Release() {
|
||||
return absl::InternalError(
|
||||
"Foreign holder can't release data ptr without ownership.");
|
||||
}
|
||||
bool HasForeignOwner() const final { return true; }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
Holder<T>* HolderBase::As() {
|
||||
if (HolderIsOfType<Holder<T>>() || HolderIsOfType<ForeignHolder<T>>()) {
|
||||
if (PayloadIsOfType<T>()) {
|
||||
return static_cast<Holder<T>*>(this);
|
||||
}
|
||||
// Does not hold a T.
|
||||
@@ -619,7 +604,7 @@ Holder<T>* HolderBase::As() {
|
||||
|
||||
template <typename T>
|
||||
const Holder<T>* HolderBase::As() const {
|
||||
if (HolderIsOfType<Holder<T>>() || HolderIsOfType<ForeignHolder<T>>()) {
|
||||
if (PayloadIsOfType<T>()) {
|
||||
return static_cast<const Holder<T>*>(this);
|
||||
}
|
||||
// Does not hold a T.
|
||||
@@ -648,7 +633,7 @@ inline absl::StatusOr<std::unique_ptr<T>> Packet::Consume() {
|
||||
MP_RETURN_IF_ERROR(ValidateAsType<T>());
|
||||
// Clients who use this function are responsible for ensuring that no
|
||||
// other thread is doing anything with this Packet.
|
||||
if (holder_.unique()) {
|
||||
if (!holder_->HasForeignOwner() && holder_.unique()) {
|
||||
VLOG(2) << "Consuming the data of " << DebugString();
|
||||
absl::StatusOr<std::unique_ptr<T>> release_result =
|
||||
holder_->As<T>()->Release();
|
||||
@@ -670,8 +655,7 @@ inline absl::StatusOr<std::unique_ptr<T>> Packet::ConsumeOrCopy(
|
||||
typename std::enable_if<!std::is_array<T>::value>::type*) {
|
||||
MP_RETURN_IF_ERROR(ValidateAsType<T>());
|
||||
// If holder is the sole owner of the underlying data, consumes this packet.
|
||||
if (!holder_->HolderIsOfType<packet_internal::ForeignHolder<T>>() &&
|
||||
holder_.unique()) {
|
||||
if (!holder_->HasForeignOwner() && holder_.unique()) {
|
||||
VLOG(2) << "Consuming the data of " << DebugString();
|
||||
absl::StatusOr<std::unique_ptr<T>> release_result =
|
||||
holder_->As<T>()->Release();
|
||||
@@ -701,8 +685,7 @@ inline absl::StatusOr<std::unique_ptr<T>> Packet::ConsumeOrCopy(
|
||||
std::extent<T>::value != 0>::type*) {
|
||||
MP_RETURN_IF_ERROR(ValidateAsType<T>());
|
||||
// If holder is the sole owner of the underlying data, consumes this packet.
|
||||
if (!holder_->HolderIsOfType<packet_internal::ForeignHolder<T>>() &&
|
||||
holder_.unique()) {
|
||||
if (!holder_->HasForeignOwner() && holder_.unique()) {
|
||||
VLOG(2) << "Consuming the data of " << DebugString();
|
||||
absl::StatusOr<std::unique_ptr<T>> release_result =
|
||||
holder_->As<T>()->Release();
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "mediapipe/framework/deps/message_matchers.h"
|
||||
#include "mediapipe/framework/packet_test.pb.h"
|
||||
#include "mediapipe/framework/port/core_proto_inc.h"
|
||||
#include "mediapipe/framework/port/gmock.h"
|
||||
@@ -374,9 +373,9 @@ TEST(PacketTest, TestConsumeForeignHolder) {
|
||||
Packet packet = PointToForeign(data.get());
|
||||
absl::StatusOr<std::unique_ptr<int>> result = packet.Consume<int>();
|
||||
EXPECT_FALSE(result.ok());
|
||||
EXPECT_EQ(result.status().code(), absl::StatusCode::kInternal);
|
||||
EXPECT_EQ(result.status().code(), absl::StatusCode::kFailedPrecondition);
|
||||
EXPECT_EQ(result.status().message(),
|
||||
"Foreign holder can't release data ptr without ownership.");
|
||||
"Packet isn't the sole owner of the holder.");
|
||||
ASSERT_FALSE(packet.IsEmpty());
|
||||
EXPECT_EQ(33, packet.Get<int>());
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "absl/base/macros.h"
|
||||
#include "absl/strings/str_split.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "mediapipe/framework/collection.h"
|
||||
#include "mediapipe/framework/packet.h"
|
||||
#include "mediapipe/framework/packet_set.h"
|
||||
@@ -133,7 +134,7 @@ class PacketTypeSetErrorHandler {
|
||||
// Returns a usable PacketType. A different PacketType object is
|
||||
// returned for each different invalid location and the same object
|
||||
// is returned for multiple accesses to the same invalid location.
|
||||
PacketType& GetFallback(const std::string& tag, int index) {
|
||||
PacketType& GetFallback(const absl::string_view tag, int index) {
|
||||
if (!missing_) {
|
||||
missing_ = absl::make_unique<Missing>();
|
||||
}
|
||||
@@ -143,7 +144,7 @@ class PacketTypeSetErrorHandler {
|
||||
}
|
||||
|
||||
// In the const setting produce a FATAL error.
|
||||
const PacketType& GetFallback(const std::string& tag, int index) const {
|
||||
const PacketType& GetFallback(const absl::string_view tag, int index) const {
|
||||
LOG(FATAL) << "Failed to get tag \"" << tag << "\" index " << index
|
||||
<< ". Unable to defer error due to const specifier.";
|
||||
std::abort();
|
||||
|
||||
@@ -176,6 +176,7 @@ cc_library(
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":status_matchers",
|
||||
"//mediapipe/framework/deps:message_matchers",
|
||||
"@com_google_googletest//:gtest",
|
||||
],
|
||||
)
|
||||
@@ -192,6 +193,7 @@ cc_library(
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":status_matchers",
|
||||
"//mediapipe/framework/deps:message_matchers",
|
||||
"//mediapipe/framework/deps:status_matchers",
|
||||
"@com_google_googletest//:gtest_main",
|
||||
],
|
||||
|
||||
@@ -16,5 +16,6 @@
|
||||
#define MEDIAPIPE_PORT_GMOCK_H_
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
#include "mediapipe/framework/deps/message_matchers.h"
|
||||
|
||||
#endif // MEDIAPIPE_PORT_GMOCK_H_
|
||||
|
||||
@@ -234,7 +234,6 @@ cc_test(
|
||||
"//mediapipe/framework:calculator_profile_cc_proto",
|
||||
"//mediapipe/framework:test_calculators",
|
||||
"//mediapipe/framework/deps:clock",
|
||||
"//mediapipe/framework/deps:message_matchers",
|
||||
"//mediapipe/framework/port:advanced_proto",
|
||||
"//mediapipe/framework/port:file_helpers",
|
||||
"//mediapipe/framework/port:gtest_main",
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "mediapipe/framework/tool/simulation_clock.h"
|
||||
#include "mediapipe/framework/tool/tag_map_helper.h"
|
||||
|
||||
using ::testing::EqualsProto;
|
||||
using ::testing::proto::Partially;
|
||||
|
||||
namespace mediapipe {
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "mediapipe/framework/calculator_framework.h"
|
||||
#include "mediapipe/framework/calculator_profile.pb.h"
|
||||
#include "mediapipe/framework/deps/clock.h"
|
||||
#include "mediapipe/framework/deps/message_matchers.h"
|
||||
#include "mediapipe/framework/port/advanced_proto_inc.h"
|
||||
#include "mediapipe/framework/port/file_helpers.h"
|
||||
#include "mediapipe/framework/port/gmock.h"
|
||||
|
||||
@@ -85,7 +85,7 @@ void BasicTraceEventTypes(TraceEventRegistry* result) {
|
||||
{TraceEvent::PACKET_QUEUED, "An input queue size when a packet arrives.",
|
||||
true, true, false},
|
||||
};
|
||||
for (TraceEventType t : basic_types) {
|
||||
for (const TraceEventType& t : basic_types) {
|
||||
(*result)[t.event_type()] = t;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,6 @@ cc_test(
|
||||
visibility = ["//mediapipe/framework:mediapipe_internal"],
|
||||
deps = [
|
||||
":executor_util",
|
||||
"//mediapipe/framework/deps:message_matchers",
|
||||
"//mediapipe/framework/port:gtest_main",
|
||||
"//mediapipe/framework/port:parse_text_proto",
|
||||
],
|
||||
@@ -302,7 +301,6 @@ mediapipe_cc_test(
|
||||
"//mediapipe/framework:calculator_framework",
|
||||
"//mediapipe/framework:calculator_runner",
|
||||
"//mediapipe/framework:validated_graph_config",
|
||||
"//mediapipe/framework/deps:message_matchers",
|
||||
"//mediapipe/framework/port:gtest_main",
|
||||
"//mediapipe/framework/port:parse_text_proto",
|
||||
"//mediapipe/framework/port:status",
|
||||
@@ -449,6 +447,7 @@ cc_library(
|
||||
"//mediapipe/framework/port:status",
|
||||
"//mediapipe/framework/port:statusor",
|
||||
"@com_google_absl//absl/base:core_headers",
|
||||
"@com_google_absl//absl/container:btree",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
@@ -613,7 +612,6 @@ cc_test(
|
||||
deps = [
|
||||
":validate_name",
|
||||
"//mediapipe/framework:calculator_cc_proto",
|
||||
"//mediapipe/framework/deps:message_matchers",
|
||||
"//mediapipe/framework/port:gtest_main",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
@@ -736,7 +734,6 @@ cc_test(
|
||||
"//mediapipe/framework:packet_type",
|
||||
"//mediapipe/framework:status_handler",
|
||||
"//mediapipe/framework:subgraph",
|
||||
"//mediapipe/framework/deps:message_matchers",
|
||||
"//mediapipe/framework/port:gtest_main",
|
||||
"//mediapipe/framework/port:logging",
|
||||
"//mediapipe/framework/port:parse_text_proto",
|
||||
@@ -885,7 +882,6 @@ cc_test(
|
||||
"//mediapipe/framework:calculator_framework",
|
||||
"//mediapipe/framework:subgraph",
|
||||
"//mediapipe/framework:test_calculators",
|
||||
"//mediapipe/framework/deps:message_matchers",
|
||||
"//mediapipe/framework/port:gtest_main",
|
||||
"//mediapipe/framework/port:logging",
|
||||
"//mediapipe/framework/port:parse_text_proto",
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
#include "mediapipe/framework/tool/executor_util.h"
|
||||
|
||||
#include "mediapipe/framework/deps/message_matchers.h"
|
||||
#include "mediapipe/framework/port/gmock.h"
|
||||
#include "mediapipe/framework/port/gtest.h"
|
||||
#include "mediapipe/framework/port/parse_text_proto.h"
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "mediapipe/framework/calculator_framework.h"
|
||||
#include "mediapipe/framework/deps/message_matchers.h"
|
||||
#include "mediapipe/framework/port/gmock.h"
|
||||
#include "mediapipe/framework/port/gtest.h"
|
||||
#include "mediapipe/framework/port/parse_text_proto.h"
|
||||
#include "mediapipe/framework/port/status_matchers.h"
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "mediapipe/framework/calculator.pb.h"
|
||||
#include "mediapipe/framework/calculator_framework.h"
|
||||
#include "mediapipe/framework/deps/message_matchers.h"
|
||||
#include "mediapipe/framework/graph_service_manager.h"
|
||||
#include "mediapipe/framework/packet.h"
|
||||
#include "mediapipe/framework/packet_set.h"
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "absl/strings/str_replace.h"
|
||||
#include "mediapipe/framework/calculator.pb.h"
|
||||
#include "mediapipe/framework/calculator_framework.h"
|
||||
#include "mediapipe/framework/deps/message_matchers.h"
|
||||
#include "mediapipe/framework/port/gmock.h"
|
||||
#include "mediapipe/framework/port/gtest.h"
|
||||
#include "mediapipe/framework/port/logging.h"
|
||||
|
||||
@@ -215,19 +215,16 @@ std::string TagMap::ShortDebugString() const {
|
||||
return output;
|
||||
}
|
||||
|
||||
bool TagMap::HasTag(const std::string& tag) const {
|
||||
return mapping_.find(tag) != mapping_.end();
|
||||
bool TagMap::HasTag(const absl::string_view tag) const {
|
||||
return mapping_.contains(tag);
|
||||
}
|
||||
|
||||
int TagMap::NumEntries(const std::string& tag) const {
|
||||
int TagMap::NumEntries(const absl::string_view tag) const {
|
||||
const auto it = mapping_.find(tag);
|
||||
if (it == mapping_.end()) {
|
||||
return 0;
|
||||
}
|
||||
return it->second.count;
|
||||
return it != mapping_.end() ? it->second.count : 0;
|
||||
}
|
||||
|
||||
CollectionItemId TagMap::GetId(const std::string& tag, int index) const {
|
||||
CollectionItemId TagMap::GetId(const absl::string_view tag, int index) const {
|
||||
const auto it = mapping_.find(tag);
|
||||
if (it == mapping_.end()) {
|
||||
return CollectionItemId::GetInvalid();
|
||||
@@ -248,11 +245,11 @@ std::pair<std::string, int> TagMap::TagAndIndexFromId(
|
||||
return {"", -1};
|
||||
}
|
||||
|
||||
CollectionItemId TagMap::BeginId(const std::string& tag) const {
|
||||
CollectionItemId TagMap::BeginId(const absl::string_view tag) const {
|
||||
return GetId(tag, 0);
|
||||
}
|
||||
|
||||
CollectionItemId TagMap::EndId(const std::string& tag) const {
|
||||
CollectionItemId TagMap::EndId(const absl::string_view tag) const {
|
||||
const auto it = mapping_.find(tag);
|
||||
if (it == mapping_.end()) {
|
||||
return CollectionItemId::GetInvalid();
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/base/macros.h"
|
||||
#include "absl/container/btree_map.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "mediapipe/framework/collection_item_id.h"
|
||||
#include "mediapipe/framework/port/canonical_errors.h"
|
||||
#include "mediapipe/framework/port/core_proto_inc.h"
|
||||
@@ -72,7 +74,9 @@ class TagMap {
|
||||
}
|
||||
|
||||
// Returns a reference to the mapping from tag to tag data.
|
||||
const std::map<std::string, TagData>& Mapping() const { return mapping_; }
|
||||
const absl::btree_map<std::string, TagData>& Mapping() const {
|
||||
return mapping_;
|
||||
}
|
||||
|
||||
// Returns the vector of names (indexed by CollectionItemId).
|
||||
const std::vector<std::string>& Names() const { return names_; }
|
||||
@@ -91,16 +95,16 @@ class TagMap {
|
||||
|
||||
// The following functions are directly utilized by collection.h see
|
||||
// that file for comments.
|
||||
bool HasTag(const std::string& tag) const;
|
||||
bool HasTag(absl::string_view tag) const;
|
||||
int NumEntries() const { return num_entries_; }
|
||||
int NumEntries(const std::string& tag) const;
|
||||
CollectionItemId GetId(const std::string& tag, int index) const;
|
||||
int NumEntries(absl::string_view tag) const;
|
||||
CollectionItemId GetId(absl::string_view tag, int index) const;
|
||||
std::set<std::string> GetTags() const;
|
||||
std::pair<std::string, int> TagAndIndexFromId(CollectionItemId id) const;
|
||||
CollectionItemId BeginId() const { return CollectionItemId(0); }
|
||||
CollectionItemId EndId() const { return CollectionItemId(num_entries_); }
|
||||
CollectionItemId BeginId(const std::string& tag) const;
|
||||
CollectionItemId EndId(const std::string& tag) const;
|
||||
CollectionItemId BeginId(absl::string_view tag) const;
|
||||
CollectionItemId EndId(absl::string_view tag) const;
|
||||
|
||||
private:
|
||||
// Use static factory function TagMap::Create().
|
||||
@@ -122,7 +126,7 @@ class TagMap {
|
||||
// The total number of entries under all tags.
|
||||
int num_entries_;
|
||||
// Mapping from tag to tag data.
|
||||
std::map<std::string, TagData> mapping_;
|
||||
absl::btree_map<std::string, TagData> mapping_;
|
||||
// The names of the data (indexed by CollectionItemId).
|
||||
std::vector<std::string> names_;
|
||||
};
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#include "mediapipe/framework/tool/proto_util_lite.h"
|
||||
|
||||
using mediapipe::proto_ns::Descriptor;
|
||||
using mediapipe::proto_ns::DescriptorPool;
|
||||
using mediapipe::proto_ns::DynamicMessageFactory;
|
||||
using mediapipe::proto_ns::EnumDescriptor;
|
||||
using mediapipe::proto_ns::EnumValueDescriptor;
|
||||
@@ -1666,7 +1665,6 @@ TemplateParser::Parser::Parser()
|
||||
allow_partial_(false),
|
||||
allow_case_insensitive_field_(false),
|
||||
allow_unknown_field_(false),
|
||||
allow_unknown_extension_(true),
|
||||
allow_unknown_enum_(false),
|
||||
allow_field_number_(false),
|
||||
allow_relaxed_whitespace_(false),
|
||||
@@ -1685,10 +1683,11 @@ bool TemplateParser::Parser::Parse(io::ZeroCopyInputStream* input,
|
||||
: ParserImpl::FORBID_SINGULAR_OVERWRITES;
|
||||
|
||||
int recursion_limit = std::numeric_limits<int>::max();
|
||||
bool allow_unknown_extension = false;
|
||||
MediaPipeParserImpl parser(
|
||||
output->GetDescriptor(), input, error_collector_, finder_,
|
||||
parse_info_tree_, overwrites_policy, allow_case_insensitive_field_,
|
||||
allow_unknown_field_, allow_unknown_extension_, allow_unknown_enum_,
|
||||
allow_unknown_field_, allow_unknown_extension, allow_unknown_enum_,
|
||||
allow_field_number_, allow_relaxed_whitespace_, allow_partial_,
|
||||
recursion_limit);
|
||||
return MergeUsingImpl(input, output, &parser);
|
||||
@@ -1703,11 +1702,12 @@ bool TemplateParser::Parser::ParseFromString(const std::string& input,
|
||||
bool TemplateParser::Parser::Merge(io::ZeroCopyInputStream* input,
|
||||
Message* output) {
|
||||
int recursion_limit = std::numeric_limits<int>::max();
|
||||
bool allow_unknown_extension = false;
|
||||
MediaPipeParserImpl parser(
|
||||
output->GetDescriptor(), input, error_collector_, finder_,
|
||||
parse_info_tree_, ParserImpl::ALLOW_SINGULAR_OVERWRITES,
|
||||
allow_case_insensitive_field_, allow_unknown_field_,
|
||||
allow_unknown_extension_, allow_unknown_enum_, allow_field_number_,
|
||||
allow_unknown_extension, allow_unknown_enum_, allow_field_number_,
|
||||
allow_relaxed_whitespace_, allow_partial_, recursion_limit);
|
||||
return MergeUsingImpl(input, output, &parser);
|
||||
}
|
||||
@@ -1737,11 +1737,12 @@ bool TemplateParser::Parser::ParseFieldValueFromString(
|
||||
const std::string& input, const FieldDescriptor* field, Message* output) {
|
||||
io::ArrayInputStream input_stream(input.data(), input.size());
|
||||
int recursion_limit = std::numeric_limits<int>::max();
|
||||
bool allow_unknown_extension = false;
|
||||
ParserImpl parser(
|
||||
output->GetDescriptor(), &input_stream, error_collector_, finder_,
|
||||
parse_info_tree_, ParserImpl::ALLOW_SINGULAR_OVERWRITES,
|
||||
allow_case_insensitive_field_, allow_unknown_field_,
|
||||
allow_unknown_extension_, allow_unknown_enum_, allow_field_number_,
|
||||
allow_unknown_extension, allow_unknown_enum_, allow_field_number_,
|
||||
allow_relaxed_whitespace_, allow_partial_, recursion_limit);
|
||||
return parser.ParseField(field, output);
|
||||
}
|
||||
|
||||
@@ -37,10 +37,6 @@ class TemplateParser {
|
||||
Parser();
|
||||
~Parser();
|
||||
|
||||
void set_allow_unknown_extension(bool allow_unknown_extension) {
|
||||
allow_unknown_extension_ = allow_unknown_extension;
|
||||
}
|
||||
|
||||
// Like TextFormat::Parse().
|
||||
bool Parse(proto_ns::io::ZeroCopyInputStream* input,
|
||||
proto_ns::Message* output);
|
||||
@@ -103,7 +99,6 @@ class TemplateParser {
|
||||
bool allow_partial_;
|
||||
bool allow_case_insensitive_field_;
|
||||
bool allow_unknown_field_;
|
||||
bool allow_unknown_extension_;
|
||||
bool allow_unknown_enum_;
|
||||
bool allow_field_number_;
|
||||
bool allow_relaxed_whitespace_;
|
||||
|
||||
@@ -56,7 +56,7 @@ absl::Status GetTagAndNameInfo(
|
||||
}
|
||||
info->names.push_back(name);
|
||||
}
|
||||
if (info->tags.size() > 0 && info->names.size() != info->tags.size()) {
|
||||
if (!info->tags.empty() && info->names.size() != info->tags.size()) {
|
||||
info->tags.clear();
|
||||
info->names.clear();
|
||||
return absl::InvalidArgumentError(absl::StrCat(
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "absl/strings/substitute.h"
|
||||
#include "mediapipe/framework/calculator.pb.h"
|
||||
#include "mediapipe/framework/deps/message_matchers.h"
|
||||
#include "mediapipe/framework/port/gmock.h"
|
||||
#include "mediapipe/framework/port/gtest.h"
|
||||
#include "mediapipe/framework/port/status_matchers.h"
|
||||
|
||||
@@ -96,7 +96,7 @@ class NodeTypeInfo {
|
||||
|
||||
// Get the input/output side packet/stream index that is the first
|
||||
// for the PacketTypeSets. Subsequent id's in the collection are
|
||||
// guaranteed to be contiguous in the master flat array.
|
||||
// guaranteed to be contiguous in the main flat array.
|
||||
int InputSidePacketBaseIndex() const { return input_side_packet_base_index_; }
|
||||
int OutputSidePacketBaseIndex() const {
|
||||
return output_side_packet_base_index_;
|
||||
@@ -154,7 +154,7 @@ class NodeTypeInfo {
|
||||
CalculatorContract contract_;
|
||||
|
||||
// The base indexes of the first entry belonging to this node in
|
||||
// the master flat arrays of ValidatedGraphConfig. Subsequent
|
||||
// the main flat arrays of ValidatedGraphConfig. Subsequent
|
||||
// entries are guaranteed to be sequential and in the order of the
|
||||
// CollectionItemIds.
|
||||
// Example:
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#include "mediapipe/framework/api2/port.h"
|
||||
#include "mediapipe/framework/calculator.pb.h"
|
||||
#include "mediapipe/framework/calculator_framework.h"
|
||||
#include "mediapipe/framework/deps/message_matchers.h"
|
||||
#include "mediapipe/framework/graph_service.h"
|
||||
#include "mediapipe/framework/port/gmock.h"
|
||||
#include "mediapipe/framework/port/gtest.h"
|
||||
#include "mediapipe/framework/port/status_matchers.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user