Merge pull request #4818 from markmcd:ios-docgen

PiperOrigin-RevId: 576628799
This commit is contained in:
Copybara-Service 2023-10-25 14:00:39 -07:00
commit 06dab1e526
10 changed files with 535 additions and 133 deletions

View File

@ -0,0 +1,342 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 56;
objects = {
/* Begin PBXBuildFile section */
8566B55D2ABABF9A00AAB22A /* MediaPipeTasksDocGen.h in Headers */ = {isa = PBXBuildFile; fileRef = 8566B55C2ABABF9A00AAB22A /* MediaPipeTasksDocGen.h */; settings = {ATTRIBUTES = (Public, ); }; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
8566B5592ABABF9A00AAB22A /* MediaPipeTasksDocGen.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MediaPipeTasksDocGen.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8566B55C2ABABF9A00AAB22A /* MediaPipeTasksDocGen.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaPipeTasksDocGen.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8566B5562ABABF9A00AAB22A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
8566B54F2ABABF9A00AAB22A = {
isa = PBXGroup;
children = (
8566B55B2ABABF9A00AAB22A /* MediaPipeTasksDocGen */,
8566B55A2ABABF9A00AAB22A /* Products */,
);
sourceTree = "<group>";
};
8566B55A2ABABF9A00AAB22A /* Products */ = {
isa = PBXGroup;
children = (
8566B5592ABABF9A00AAB22A /* MediaPipeTasksDocGen.framework */,
);
name = Products;
sourceTree = "<group>";
};
8566B55B2ABABF9A00AAB22A /* MediaPipeTasksDocGen */ = {
isa = PBXGroup;
children = (
8566B55C2ABABF9A00AAB22A /* MediaPipeTasksDocGen.h */,
);
path = MediaPipeTasksDocGen;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
8566B5542ABABF9A00AAB22A /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
8566B55D2ABABF9A00AAB22A /* MediaPipeTasksDocGen.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
8566B5582ABABF9A00AAB22A /* MediaPipeTasksDocGen */ = {
isa = PBXNativeTarget;
buildConfigurationList = 8566B5602ABABF9A00AAB22A /* Build configuration list for PBXNativeTarget "MediaPipeTasksDocGen" */;
buildPhases = (
8566B5542ABABF9A00AAB22A /* Headers */,
8566B5552ABABF9A00AAB22A /* Sources */,
8566B5562ABABF9A00AAB22A /* Frameworks */,
8566B5572ABABF9A00AAB22A /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = MediaPipeTasksDocGen;
productName = MediaPipeTasksDocGen;
productReference = 8566B5592ABABF9A00AAB22A /* MediaPipeTasksDocGen.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
8566B5502ABABF9A00AAB22A /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastUpgradeCheck = 1430;
TargetAttributes = {
8566B5582ABABF9A00AAB22A = {
CreatedOnToolsVersion = 14.3.1;
};
};
};
buildConfigurationList = 8566B5532ABABF9A00AAB22A /* Build configuration list for PBXProject "MediaPipeTasksDocGen" */;
compatibilityVersion = "Xcode 14.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 8566B54F2ABABF9A00AAB22A;
productRefGroup = 8566B55A2ABABF9A00AAB22A /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
8566B5582ABABF9A00AAB22A /* MediaPipeTasksDocGen */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
8566B5572ABABF9A00AAB22A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
8566B5552ABABF9A00AAB22A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
8566B55E2ABABF9A00AAB22A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Debug;
};
8566B55F2ABABF9A00AAB22A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Release;
};
8566B5612ABABF9A00AAB22A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_MODULE_VERIFIER = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++20";
PRODUCT_BUNDLE_IDENTIFIER = com.google.mediapipe.MediaPipeTasksDocGen;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
8566B5622ABABF9A00AAB22A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_MODULE_VERIFIER = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++20";
PRODUCT_BUNDLE_IDENTIFIER = com.google.mediapipe.MediaPipeTasksDocGen;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
8566B5532ABABF9A00AAB22A /* Build configuration list for PBXProject "MediaPipeTasksDocGen" */ = {
isa = XCConfigurationList;
buildConfigurations = (
8566B55E2ABABF9A00AAB22A /* Debug */,
8566B55F2ABABF9A00AAB22A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
8566B5602ABABF9A00AAB22A /* Build configuration list for PBXNativeTarget "MediaPipeTasksDocGen" */ = {
isa = XCConfigurationList;
buildConfigurations = (
8566B5612ABABF9A00AAB22A /* Debug */,
8566B5622ABABF9A00AAB22A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 8566B5502ABABF9A00AAB22A /* Project object */;
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>MediaPipeTasksDocGen.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>

View File

@ -0,0 +1,17 @@
//
// MediaPipeTasksDocGen.h
// MediaPipeTasksDocGen
//
// Created by Mark McDonald on 20/9/2023.
//
#import <Foundation/Foundation.h>
//! Project version number for MediaPipeTasksDocGen.
FOUNDATION_EXPORT double MediaPipeTasksDocGenVersionNumber;
//! Project version string for MediaPipeTasksDocGen.
FOUNDATION_EXPORT const unsigned char MediaPipeTasksDocGenVersionString[];
// In this header, you should import all the public headers of your framework using statements like
// #import <MediaPipeTasksDocGen/PublicHeader.h>

View File

@ -0,0 +1,11 @@
# Uncomment the next line to define a global platform for your project
platform :ios, '15.0'
target 'MediaPipeTasksDocGen' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for MediaPipeTasksDocGen
pod 'MediaPipeTasksText'
pod 'MediaPipeTasksVision'
end

View File

@ -0,0 +1,9 @@
# MediaPipeTasksDocGen
This empty project is used to generate reference documentation for the
ObjectiveC and Swift libraries.
Docs are generated using [Jazzy](https://github.com/realm/jazzy) and published
to [the developer site](https://developers.google.com/mediapipe/solutions/).
To bump the API version used, edit [`Podfile`](./Podfile).

View File

@ -1480,7 +1480,6 @@ cc_test(
"@com_google_absl//absl/log", "@com_google_absl//absl/log",
"@com_google_absl//absl/log:absl_log", "@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"@com_google_googletest//:gtest_main",
], ],
) )

View File

@ -60,47 +60,38 @@ struct FormattingTestCase {
std::vector<float> inputs; std::vector<float> inputs;
std::vector<float> expected_outputs; std::vector<float> expected_outputs;
Options::Activation activation; Options::Activation activation;
int rows; int rows = 1;
int cols; int cols = 1;
int rows_new; int rows_new = 1;
int cols_new; int cols_new = 1;
int channels; int channels = 1;
double max_abs_diff; double max_abs_diff = 1e-7;
}; };
using TensorsToSegmentationCalculatorTest = TestWithParam<FormattingTestCase>; using TensorsToSegmentationCalculatorTest = TestWithParam<FormattingTestCase>;
TEST_P(TensorsToSegmentationCalculatorTest, ParameterizedTests) { TEST_P(TensorsToSegmentationCalculatorTest, ParameterizedTests) {
const FormattingTestCase& test_case = GetParam(); const auto& [test_name, inputs, expected_outputs, activation, rows, cols,
std::vector<float> inputs = test_case.inputs; rows_new, cols_new, channels, max_abs_diff] = GetParam();
std::vector<float> expected_outputs = test_case.expected_outputs;
Options::Activation activation = test_case.activation;
int rows = test_case.rows;
int cols = test_case.cols;
int rows_new = test_case.rows_new;
int cols_new = test_case.cols_new;
int channels = test_case.channels;
double max_abs_diff = test_case.max_abs_diff;
std::string string_config = absl::Substitute(
R"pb(
input_stream: "tensors"
input_stream: "size"
node {
calculator: "TensorsToSegmentationCalculator"
input_stream: "TENSORS:tensors"
input_stream: "OUTPUT_SIZE:size"
output_stream: "MASK:image_as_mask"
options: {
[mediapipe.TensorsToSegmentationCalculatorOptions.ext] {
activation: $0
}
}
}
)pb",
ActivationTypeToString(activation));
auto graph_config = auto graph_config =
mediapipe::ParseTextProtoOrDie<CalculatorGraphConfig>(string_config); mediapipe::ParseTextProtoOrDie<CalculatorGraphConfig>(absl::Substitute(
R"pb(
input_stream: "tensors"
input_stream: "size"
node {
calculator: "TensorsToSegmentationCalculator"
input_stream: "TENSORS:tensors"
input_stream: "OUTPUT_SIZE:size"
output_stream: "MASK:image_as_mask"
options: {
[mediapipe.TensorsToSegmentationCalculatorOptions.ext] {
activation: $0
}
}
}
)pb",
ActivationTypeToString(activation)));
std::vector<Packet> output_packets; std::vector<Packet> output_packets;
tool::AddVectorSink("image_as_mask", &graph_config, &output_packets); tool::AddVectorSink("image_as_mask", &graph_config, &output_packets);
@ -124,6 +115,7 @@ TEST_P(TensorsToSegmentationCalculatorTest, ParameterizedTests) {
MP_ASSERT_OK(graph.AddPacketToInputStream( MP_ASSERT_OK(graph.AddPacketToInputStream(
"tensors", mediapipe::Adopt(tensors.release()).At(Timestamp(0)))); "tensors", mediapipe::Adopt(tensors.release()).At(Timestamp(0))));
} }
// The output size is defined as pair(new_width, new_height). // The output size is defined as pair(new_width, new_height).
MP_ASSERT_OK(graph.AddPacketToInputStream( MP_ASSERT_OK(graph.AddPacketToInputStream(
"size", mediapipe::Adopt(new std::pair<int, int>(cols_new, rows_new)) "size", mediapipe::Adopt(new std::pair<int, int>(cols_new, rows_new))
@ -132,6 +124,8 @@ TEST_P(TensorsToSegmentationCalculatorTest, ParameterizedTests) {
ASSERT_THAT(output_packets, SizeIs(1)); ASSERT_THAT(output_packets, SizeIs(1));
const Image& image_as_mask = output_packets[0].Get<Image>(); const Image& image_as_mask = output_packets[0].Get<Image>();
EXPECT_FALSE(image_as_mask.UsesGpu());
std::shared_ptr<cv::Mat> result_mat = formats::MatView(&image_as_mask); std::shared_ptr<cv::Mat> result_mat = formats::MatView(&image_as_mask);
EXPECT_EQ(result_mat->rows, rows_new); EXPECT_EQ(result_mat->rows, rows_new);
EXPECT_EQ(result_mat->cols, cols_new); EXPECT_EQ(result_mat->cols, cols_new);
@ -157,104 +151,105 @@ TEST_P(TensorsToSegmentationCalculatorTest, ParameterizedTests) {
INSTANTIATE_TEST_SUITE_P( INSTANTIATE_TEST_SUITE_P(
TensorsToSegmentationCalculatorTests, TensorsToSegmentationCalculatorTest, TensorsToSegmentationCalculatorTests, TensorsToSegmentationCalculatorTest,
testing::ValuesIn<FormattingTestCase>( testing::ValuesIn<FormattingTestCase>({
{{/*test_name=*/"NoActivationAndNoOutputResize", {/*test_name=*/"NoActivationAndNoOutputResize",
/*inputs=*/ /*inputs=*/
{1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
14.0, 15.0, 16.0}, 14.0, 15.0, 16.0},
/*expected_outputs=*/ /*expected_outputs=*/
{1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
14.0, 15.0, 16.0}, 14.0, 15.0, 16.0},
/*activation=*/Options::NONE, /*activation=*/Options::NONE,
/*rows=*/4, /*rows=*/4,
/*cols=*/4, /*cols=*/4,
/*rows_new=*/4, /*rows_new=*/4,
/*cols_new=*/4, /*cols_new=*/4,
/*channels=*/1, /*channels=*/1,
/*max_abs_diff=*/1e-7}, /*max_abs_diff=*/1e-7},
{/*test_name=*/"OutputResizeOnly", {/*test_name=*/"OutputResizeOnly",
/*inputs=*/ /*inputs=*/
{1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
14.0, 15.0, 16.0}, 14.0, 15.0, 16.0},
/*expected_outputs=*/ /*expected_outputs=*/
{1, 1.5, 2.166667, 2.833333, 3.5, 4, {1, 1.5, 2.166667, 2.833333, 3.5, 4,
3.8, 4.3, 4.966667, 5.633333, 6.3, 6.8, 3.8, 4.3, 4.966667, 5.633333, 6.3, 6.8,
7, 7.5, 8.166667, 8.833333, 9.5, 10, 7, 7.5, 8.166667, 8.833333, 9.5, 10,
10.2, 10.7, 11.366667, 12.033333, 12.7, 13.2, 10.2, 10.7, 11.366667, 12.033333, 12.7, 13.2,
13, 13.5, 14.166667, 14.833333, 15.5, 16}, 13, 13.5, 14.166667, 14.833333, 15.5, 16},
/*activation=*/Options::NONE, /*activation=*/Options::NONE,
/*rows=*/4, /*rows=*/4,
/*cols=*/4, /*cols=*/4,
/*rows_new=*/5, /*rows_new=*/5,
/*cols_new=*/6, /*cols_new=*/6,
/*channels=*/1, /*channels=*/1,
/*max_abs_diff=*/1e-6}, /*max_abs_diff=*/1e-6},
{/*test_name=*/"SigmoidActivationWithNoOutputResize", {/*test_name=*/"SigmoidActivationWithNoOutputResize",
/*inputs=*/ /*inputs=*/
{1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
14.0, 15.0, 16.0}, 14.0, 15.0, 16.0},
/*expected_outputs=*/ /*expected_outputs=*/
{0.731059, 0.880797, 0.952574, 0.982014, 0.993307, 0.997527, 0.999089, {0.731059, 0.880797, 0.952574, 0.982014, 0.993307, 0.997527, 0.999089,
0.999665, 0.999877, 0.999955, 0.999983, 0.999994, 0.999998, 0.999999, 0.999665, 0.999877, 0.999955, 0.999983, 0.999994, 0.999998, 0.999999,
1.0, 1.0}, 1.0, 1.0},
/*activation=*/Options::SIGMOID, /*activation=*/Options::SIGMOID,
/*rows=*/4, /*rows=*/4,
/*cols=*/4, /*cols=*/4,
/*rows_new=*/4, /*rows_new=*/4,
/*cols_new=*/4, /*cols_new=*/4,
/*channels=*/1, /*channels=*/1,
/*max_abs_diff=*/1e-6}, /*max_abs_diff=*/1e-6},
{/*test_name=*/"SigmoidActivationWithOutputResize", {/*test_name=*/"SigmoidActivationWithOutputResize",
/*inputs=*/ /*inputs=*/
{1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
14.0, 15.0, 16.0}, 14.0, 15.0, 16.0},
/*expected_outputs=*/ /*expected_outputs=*/
{0.731059, 0.805928, 0.89276, 0.940611, 0.967294, 0.982014, {0.731059, 0.805928, 0.89276, 0.940611, 0.967294, 0.982014,
0.914633, 0.93857, 0.966279, 0.981363, 0.989752, 0.994369, 0.914633, 0.93857, 0.966279, 0.981363, 0.989752, 0.994369,
0.996592, 0.997666, 0.998873, 0.999404, 0.999683, 0.999829, 0.996592, 0.997666, 0.998873, 0.999404, 0.999683, 0.999829,
0.999913, 0.99994, 0.999971, 0.999985, 0.999992, 0.999996, 0.999913, 0.99994, 0.999971, 0.999985, 0.999992, 0.999996,
0.999998, 0.999998, 0.999999, 1.0, 1.0, 1.0}, 0.999998, 0.999998, 0.999999, 1.0, 1.0, 1.0},
/*activation=*/Options::SIGMOID, /*activation=*/Options::SIGMOID,
/*rows=*/4, /*rows=*/4,
/*cols=*/4, /*cols=*/4,
/*rows_new=*/5, /*rows_new=*/5,
/*cols_new=*/6, /*cols_new=*/6,
/*channels=*/1, /*channels=*/1,
/*max_abs_diff=*/1e-6}, /*max_abs_diff=*/1e-6},
{/*test_name=*/"SoftmaxActivationWithNoOutputResize", {/*test_name=*/"SoftmaxActivationWithNoOutputResize",
/*inputs=*/ /*inputs=*/
{1.0, 2.0, 4.0, 2.0, 3.0, 5.0, 6.0, 1.5, 7.0, 10.0, 11.0, {1.0, 2.0, 4.0, 2.0, 3.0, 5.0, 6.0, 1.5, 7.0, 10.0, 11.0,
4.0, 12.0, 15.0, 16.0, 18.5, 19.0, 20.0, 22.0, 23.0, 24.5, 23.4, 4.0, 12.0, 15.0, 16.0, 18.5, 19.0, 20.0, 22.0, 23.0, 24.5, 23.4,
25.6, 28.3, 29.2, 30.0, 24.6, 29.2, 30.0, 24.9, 31.2, 30.3}, 25.6, 28.3, 29.2, 30.0, 24.6, 29.2, 30.0, 24.9, 31.2, 30.3},
/*expected_outputs=*/ /*expected_outputs=*/
{0.731059, 0.119203, 0.880797, 0.0109869, 0.952574, 0.000911051, {0.731059, 0.119203, 0.880797, 0.0109869, 0.952574, 0.000911051,
0.952574, 0.924142, 0.731059, 0.731059, 0.24974, 0.937027, 0.689974, 0.952574, 0.924142, 0.731059, 0.731059, 0.24974, 0.937027, 0.689974,
0.990048, 0.0060598, 0.28905}, 0.990048, 0.0060598, 0.28905},
/*activation=*/Options::SOFTMAX, /*activation=*/Options::SOFTMAX,
/*rows=*/4, /*rows=*/4,
/*cols=*/4, /*cols=*/4,
/*rows_new=*/4, /*rows_new=*/4,
/*cols_new=*/4, /*cols_new=*/4,
/*channels=*/2, /*channels=*/2,
/*max_abs_diff=*/1e-6}, /*max_abs_diff=*/1e-6},
{/*test_name=*/"SoftmaxActivationWithOutputResize", {/*test_name=*/"SoftmaxActivationWithOutputResize",
/*inputs=*/ /*inputs=*/
{1.0, 2.0, 4.0, 2.0, 3.0, 5.0, 6.0, 1.5, 7.0, 10.0, 11.0, {1.0, 2.0, 4.0, 2.0, 3.0, 5.0, 6.0, 1.5, 7.0, 10.0, 11.0,
4.0, 12.0, 15.0, 16.0, 18.5, 19.0, 20.0, 22.0, 23.0, 24.5, 23.4, 4.0, 12.0, 15.0, 16.0, 18.5, 19.0, 20.0, 22.0, 23.0, 24.5, 23.4,
25.6, 28.3, 29.2, 30.0, 24.6, 29.2, 30.0, 24.9, 31.2, 30.3}, 25.6, 28.3, 29.2, 30.0, 24.6, 29.2, 30.0, 24.9, 31.2, 30.3},
/*expected_outputs=*/ /*expected_outputs=*/
{0.731059, 0.425131, 0.246135, 0.753865, 0.445892, 0.0109869, {0.731059, 0.425131, 0.246135, 0.753865, 0.445892, 0.0109869,
0.886119, 0.461259, 0.185506, 0.781934, 0.790618, 0.650195, 0.886119, 0.461259, 0.185506, 0.781934, 0.790618, 0.650195,
0.841816, 0.603901, 0.40518, 0.561962, 0.765871, 0.930584, 0.841816, 0.603901, 0.40518, 0.561962, 0.765871, 0.930584,
0.718733, 0.763744, 0.703402, 0.281989, 0.459635, 0.742634, 0.718733, 0.763744, 0.703402, 0.281989, 0.459635, 0.742634,
0.689974, 0.840011, 0.82605, 0.170058, 0.147555, 0.28905}, 0.689974, 0.840011, 0.82605, 0.170058, 0.147555, 0.28905},
/*activation=*/Options::SOFTMAX, /*activation=*/Options::SOFTMAX,
/*rows=*/4, /*rows=*/4,
/*cols=*/4, /*cols=*/4,
/*rows_new=*/5, /*rows_new=*/5,
/*cols_new=*/6, /*cols_new=*/6,
/*channels=*/2, /*channels=*/2,
/*max_abs_diff=*/1e-6}}), /*max_abs_diff=*/1e-6},
}),
[](const testing::TestParamInfo< [](const testing::TestParamInfo<
TensorsToSegmentationCalculatorTest::ParamType>& info) { TensorsToSegmentationCalculatorTest::ParamType>& info) {
return info.param.test_name; return info.param.test_name;