chore: import upstream snapshot with attribution
cffconvert / validate (push) Has been skipped
License Check / license-check (push) Failing after 2s

This commit is contained in:
wehub-resource-sync
2026-07-13 12:14:16 +08:00
commit 8a852e4b4e
36502 changed files with 9277225 additions and 0 deletions
@@ -0,0 +1,913 @@
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test")
load("@rules_cc//cc:objc_library.bzl", "objc_library")
load(
"//tensorflow/core/platform:build_config_root.bzl",
"tf_gpu_tests_tags",
)
load(
"//tensorflow/lite:special_rules.bzl",
"tflite_ios_lab_runner",
"tflite_ios_per_kernel_test",
"tflite_portable_test_suite",
)
package(
# copybara:uncomment default_applicable_licenses = ["//tensorflow:LICENSE"],
default_visibility = ["//visibility:public"],
licenses = ["notice"],
)
objc_library(
name = "add_test_lib",
testonly = 1,
srcs = ["add_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:add_test_util",
],
)
ios_unit_test(
name = "add_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":add_test_lib"],
)
objc_library(
name = "cast_test_lib",
testonly = 1,
srcs = ["cast_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common:status",
"//tensorflow/lite/delegates/gpu/common/tasks:cast_test_util",
],
)
ios_unit_test(
name = "cast_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":cast_test_lib"],
)
objc_library(
name = "concat_test_lib",
testonly = 1,
srcs = ["concat_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:concat_test_util",
],
)
ios_unit_test(
name = "concat_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":concat_test_lib"],
)
objc_library(
name = "conv_test_lib",
testonly = 1,
srcs = ["conv_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common:operations",
"//tensorflow/lite/delegates/gpu/common:shape",
"//tensorflow/lite/delegates/gpu/common:status",
"//tensorflow/lite/delegates/gpu/common:tensor",
"//tensorflow/lite/delegates/gpu/common:util",
"//tensorflow/lite/delegates/gpu/common/tasks:conv_constants_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:conv_generic",
"//tensorflow/lite/delegates/gpu/common/tasks:conv_generic_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:conv_metal_simd",
"//tensorflow/lite/delegates/gpu/common/tasks:winograd",
"//tensorflow/lite/delegates/gpu/metal:compute_task",
"//tensorflow/lite/delegates/gpu/metal:metal_spatial_tensor",
],
)
ios_unit_test(
name = "conv_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":conv_test_lib"],
)
objc_library(
name = "conv_weights_converter_test_lib",
testonly = 1,
srcs = ["conv_weights_converter_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:conv_weights_converter_test_util",
],
)
ios_unit_test(
name = "conv_weights_converter_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":conv_weights_converter_test_lib"],
)
objc_library(
name = "cumsum_test_lib",
testonly = 1,
srcs = ["cumsum_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common:status",
"//tensorflow/lite/delegates/gpu/common/tasks:cumsum_test_util",
],
)
ios_unit_test(
name = "cumsum_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":cumsum_test_lib"],
)
objc_library(
name = "depthwise_conv_test_lib",
testonly = 1,
srcs = ["depthwise_conv_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:depthwise_conv_3x3_stride_h2_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:depthwise_conv_3x3_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:depthwise_conv_test_util",
],
)
ios_unit_test(
name = "depthwise_conv_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":depthwise_conv_test_lib"],
)
objc_library(
name = "elementwise_test_lib",
testonly = 1,
srcs = ["elementwise_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common:status",
"//tensorflow/lite/delegates/gpu/common/tasks:elementwise_test_util",
],
)
ios_unit_test(
name = "elementwise_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":elementwise_test_lib"],
)
objc_library(
name = "fully_connected_test_lib",
testonly = 1,
srcs = ["fully_connected_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:fully_connected_test_util",
],
)
ios_unit_test(
name = "fully_connected_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":fully_connected_test_lib"],
)
objc_library(
name = "gather_test_lib",
testonly = 1,
srcs = ["gather_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:gather_test_util",
],
)
ios_unit_test(
name = "gather_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":gather_test_lib"],
)
objc_library(
name = "lstm_test_lib",
testonly = 1,
srcs = ["lstm_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:lstm_test_util",
],
)
ios_unit_test(
name = "lstm_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":lstm_test_lib"],
)
objc_library(
name = "max_unpooling_test_lib",
testonly = 1,
srcs = ["max_unpooling_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:max_unpooling_test_util",
],
)
ios_unit_test(
name = "max_unpooling_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":max_unpooling_test_lib"],
)
objc_library(
name = "mean_stddev_normalization_test_lib",
testonly = 1,
srcs = ["mean_stddev_normalization_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:mean_stddev_normalization_test_util",
],
)
ios_unit_test(
name = "mean_stddev_normalization_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":mean_stddev_normalization_test_lib"],
)
objc_library(
name = "one_hot_test_lib",
testonly = 1,
srcs = ["one_hot_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common:status",
"//tensorflow/lite/delegates/gpu/common/tasks:one_hot_test_util",
],
)
ios_unit_test(
name = "one_hot_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":one_hot_test_lib"],
)
objc_library(
name = "padding_test_lib",
testonly = 1,
srcs = ["padding_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:padding_test_util",
],
)
ios_unit_test(
name = "padding_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":padding_test_lib"],
)
objc_library(
name = "pooling_test_lib",
testonly = 1,
srcs = ["pooling_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:pooling_test_util",
],
)
ios_unit_test(
name = "pooling_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":pooling_test_lib"],
)
objc_library(
name = "prelu_test_lib",
testonly = 1,
srcs = ["prelu_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:prelu_test_util",
],
)
ios_unit_test(
name = "prelu_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":prelu_test_lib"],
)
objc_library(
name = "quantize_and_dequantize_test_lib",
testonly = 1,
srcs = ["quantize_and_dequantize_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common:operations",
"//tensorflow/lite/delegates/gpu/common:shape",
"//tensorflow/lite/delegates/gpu/common:status",
"//tensorflow/lite/delegates/gpu/common:tensor",
"//tensorflow/lite/delegates/gpu/common:util",
"//tensorflow/lite/delegates/gpu/common/tasks:quantize_and_dequantize_test_util",
],
)
ios_unit_test(
name = "quantize_and_dequantize_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":quantize_and_dequantize_test_lib"],
)
objc_library(
name = "reduce_test_lib",
testonly = 1,
srcs = ["reduce_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:reduce_test_util",
],
)
ios_unit_test(
name = "reduce_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":reduce_test_lib"],
)
objc_library(
name = "relu_test_lib",
testonly = 1,
srcs = ["relu_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:relu_test_util",
],
)
ios_unit_test(
name = "relu_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":relu_test_lib"],
)
objc_library(
name = "resampler_test_lib",
testonly = 1,
srcs = ["resampler_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
"//tensorflow/lite/delegates/gpu/common:shape",
"//tensorflow/lite/delegates/gpu/common:status",
"//tensorflow/lite/delegates/gpu/common/tasks:resampler_test_util",
"//tensorflow/lite/delegates/gpu/metal/kernels:test_util",
],
)
ios_unit_test(
name = "resampler_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = [
"no_mac", # TODO(b/183905399)
"notap",
"tflite_mobile_test_jet",
"tflite_not_portable_android",
],
deps = [":resampler_test_lib"],
)
objc_library(
name = "resize_test_lib",
testonly = 1,
srcs = ["resize_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:resize_test_util",
],
)
ios_unit_test(
name = "resize_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":resize_test_lib"],
)
objc_library(
name = "reshape_test_lib",
testonly = 1,
srcs = ["reshape_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:reshape_test_util",
],
)
ios_unit_test(
name = "reshape_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":reshape_test_lib"],
)
objc_library(
name = "select_v2_test_lib",
testonly = 1,
srcs = ["select_v2_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:select_v2_test_util",
],
)
ios_unit_test(
name = "select_v2_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":select_v2_test_lib"],
)
objc_library(
name = "slice_test_lib",
testonly = 1,
srcs = ["slice_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:strided_slice_test_util",
],
)
ios_unit_test(
name = "slice_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":slice_test_lib"],
)
objc_library(
name = "softmax_test_lib",
testonly = 1,
srcs = ["softmax_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:softmax_test_util",
],
)
ios_unit_test(
name = "softmax_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":softmax_test_lib"],
)
objc_library(
name = "space_to_depth_test_lib",
testonly = 1,
srcs = ["space_to_depth_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common:status",
"//tensorflow/lite/delegates/gpu/common/tasks:space_to_depth_test_util",
],
)
ios_unit_test(
name = "space_to_depth_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":space_to_depth_test_lib"],
)
objc_library(
name = "split_test_lib",
testonly = 1,
srcs = ["split_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:split_test_util",
],
)
ios_unit_test(
name = "split_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":split_test_lib"],
)
objc_library(
name = "tile_test_lib",
testonly = 1,
srcs = ["tile_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:tile_test_util",
],
)
ios_unit_test(
name = "tile_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":tile_test_lib"],
)
objc_library(
name = "transpose_conv_test_lib",
testonly = 1,
srcs = ["transpose_conv_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:convolution_transposed_3x3_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:convolution_transposed_3x3_thin_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:convolution_transposed_4x4_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:convolution_transposed_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:convolution_transposed_thin_test_util",
],
)
ios_unit_test(
name = "transpose_conv_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":transpose_conv_test_lib"],
)
objc_library(
name = "transpose_test_lib",
testonly = 1,
srcs = ["transpose_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:transpose_test_util",
],
)
ios_unit_test(
name = "transpose_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":transpose_test_lib"],
)
objc_library(
name = "test_util",
testonly = 1,
srcs = [
"test_util.cc",
],
hdrs = ["test_util.h"],
copts = [
"-ObjC++",
],
sdk_frameworks = ["Metal"],
deps = [
"//tensorflow/lite/delegates/gpu/common:convert",
"//tensorflow/lite/delegates/gpu/common:gpu_info",
"//tensorflow/lite/delegates/gpu/common:precision",
"//tensorflow/lite/delegates/gpu/common:shape",
"//tensorflow/lite/delegates/gpu/common:status",
"//tensorflow/lite/delegates/gpu/common:tensor",
"//tensorflow/lite/delegates/gpu/common:types",
"//tensorflow/lite/delegates/gpu/common:util",
"//tensorflow/lite/delegates/gpu/common/task:gpu_operation",
"//tensorflow/lite/delegates/gpu/common/task:testing_util",
"//tensorflow/lite/delegates/gpu/metal:compute_task",
"//tensorflow/lite/delegates/gpu/metal:metal_device",
"//tensorflow/lite/delegates/gpu/metal:metal_spatial_tensor",
"@com_google_absl//absl/strings",
],
)
objc_library(
name = "winograd_test_lib",
testonly = 1,
srcs = ["winograd_test.mm"],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common:winograd_util",
"//tensorflow/lite/delegates/gpu/common/tasks:winograd_test_util",
],
)
ios_unit_test(
name = "winograd_test",
testonly = 1,
minimum_os_version = "15.0",
runner = tflite_ios_lab_runner("IOS_LATEST"),
tags = tf_gpu_tests_tags() + [
"notap",
"tflite_not_portable_android",
],
deps = [":winograd_test_lib"],
)
objc_library(
name = "kernel_tests_lib",
testonly = 1,
srcs = [
"add_test.mm",
"cast_test.mm",
"concat_test.mm",
"conv_test.mm",
"conv_weights_converter_test.mm",
"cumsum_test.mm",
"depthwise_conv_test.mm",
"elementwise_test.mm",
"fully_connected_test.mm",
"gather_test.mm",
"lstm_test.mm",
"max_unpooling_test.mm",
"mean_stddev_normalization_test.mm",
"one_hot_test.mm",
"padding_test.mm",
"pooling_test.mm",
"prelu_test.mm",
"quantize_and_dequantize_test.mm",
"reduce_test.mm",
"relu_test.mm",
"resampler_test.mm",
"reshape_test.mm",
"resize_test.mm",
"select_v2_test.mm",
"slice_test.mm",
"softmax_test.mm",
"space_to_depth_test.mm",
"split_test.mm",
"tile_test.mm",
"transpose_conv_test.mm",
"transpose_test.mm",
"winograd_test.mm",
],
hdrs = [
],
sdk_frameworks = ["XCTest"],
deps = [
":test_util",
"//tensorflow/lite/delegates/gpu/common:operations",
"//tensorflow/lite/delegates/gpu/common:shape",
"//tensorflow/lite/delegates/gpu/common:status",
"//tensorflow/lite/delegates/gpu/common:tensor",
"//tensorflow/lite/delegates/gpu/common:util",
"//tensorflow/lite/delegates/gpu/common/tasks:add_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:cast_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:concat_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:conv_constants_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:conv_generic",
"//tensorflow/lite/delegates/gpu/common/tasks:conv_generic_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:conv_metal_simd",
"//tensorflow/lite/delegates/gpu/common/tasks:conv_weights_converter_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:convolution_transposed_3x3_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:convolution_transposed_3x3_thin_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:convolution_transposed_4x4_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:convolution_transposed_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:convolution_transposed_thin_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:cumsum_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:depthwise_conv_3x3_stride_h2_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:depthwise_conv_3x3_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:depthwise_conv_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:elementwise_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:fully_connected_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:gather_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:lstm_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:max_unpooling_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:mean_stddev_normalization_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:one_hot_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:padding_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:pooling_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:prelu_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:quantize_and_dequantize_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:reduce_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:relu_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:resampler_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:reshape_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:resize_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:select_v2_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:softmax_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:space_to_depth_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:split_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:strided_slice_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:tile_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:transpose_test_util",
"//tensorflow/lite/delegates/gpu/common/tasks:winograd",
"//tensorflow/lite/delegates/gpu/common/tasks:winograd_test_util",
"//tensorflow/lite/delegates/gpu/metal:compute_task",
"//tensorflow/lite/delegates/gpu/metal:metal_spatial_tensor",
],
)
tflite_portable_test_suite()
tflite_ios_per_kernel_test()
@@ -0,0 +1,44 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/add_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface AddTest : XCTestCase
@end
@implementation AddTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testAddTwoEqualTensors {
auto status = AddTwoEqualTensorsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testAddFirstTensorHasMoreChannelsThanSecond {
auto status = AddFirstTensorHasMoreChannelsThanSecondTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testAddFirstTensorHasLessChannelsThanSecond {
auto status = AddFirstTensorHasLessChannelsThanSecond(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,44 @@
/* Copyright 2022 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/cast_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface CastMetalTest : XCTestCase
@end
@implementation CastMetalTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testCast {
auto status = CastTests(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testFromBoolCast {
auto status = CastFromBoolTests(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testToBoolCast {
auto status = CastToBoolTests(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,49 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/concat_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface ConcatTest : XCTestCase
@end
@implementation ConcatTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testConcatWidth {
auto status = ConcatWidthTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConcatHeight {
auto status = ConcatHeightTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConcatChannels {
auto status = ConcatChannelsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConcatChannelsAlignedx4 {
auto status = ConcatChannelsAlignedx4Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,445 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
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 "tensorflow/lite/delegates/gpu/metal/compute_task.h"
#import <XCTest/XCTest.h>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "tensorflow/lite/delegates/gpu/common/operations.h"
#include "tensorflow/lite/delegates/gpu/common/shape.h"
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/conv_constants_test_util.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/conv_generic.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/conv_generic_test_util.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/conv_metal_simd.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/winograd.h"
#include "tensorflow/lite/delegates/gpu/common/tensor.h"
#include "tensorflow/lite/delegates/gpu/common/util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/metal_spatial_tensor.h"
@interface ConvTest : XCTestCase
@end
@implementation ConvTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
namespace tflite {
namespace gpu {
namespace metal {
absl::Status Winograd4x4To6x6Test(TestExecutionEnvironment* env) {
const int src_channels = 7;
const int dst_channels = 13;
Convolution2DAttributes attr;
attr.padding.prepended = HW(0, 0);
attr.padding.appended = HW(10, 10);
attr.strides = HW(1, 1);
attr.dilations = HW(1, 1);
attr.weights.shape = OHWI(dst_channels, 3, 3, src_channels);
attr.weights.data.resize(attr.weights.shape.DimensionsProduct());
for (int i = 0; i < attr.weights.data.size(); ++i) {
attr.weights.data[i] = sin(i);
}
attr.bias.shape = Linear(dst_channels);
attr.bias.data.resize(attr.bias.shape.DimensionsProduct());
for (int i = 0; i < attr.bias.data.size(); ++i) {
attr.bias.data[i] = sin(i);
}
auto src_shape = BHWC(1, 17, 13, src_channels);
auto dst_shape = CalculateOutputShape(src_shape, attr);
int new_width = src_shape.w + attr.padding.prepended.w + attr.padding.appended.w - 2;
int new_height = src_shape.h + attr.padding.prepended.h + attr.padding.appended.h - 2;
BHWC conv_shape;
conv_shape.b = dst_shape.b;
conv_shape.h = 36;
conv_shape.w = DivideRoundUp(new_width, 4) * DivideRoundUp(new_height, 4);
conv_shape.c = dst_shape.c;
TensorFloat32 src_tensor;
src_tensor.shape = src_shape;
src_tensor.data.resize(src_tensor.shape.DimensionsProduct());
for (int i = 0; i < src_tensor.data.size(); ++i) {
src_tensor.data[i] = sin(i);
}
for (auto precision : env->GetSupportedPrecisions()) {
auto data_type = DeduceDataTypeFromPrecision(precision);
for (auto storage : env->GetSupportedStorages(data_type)) {
const float eps = precision == CalculationsPrecision::F32 ? 1e-4f : 0.4f;
OperationDef op_def;
op_def.precision = precision;
op_def.src_tensors.push_back({data_type, storage, Layout::HWC});
op_def.dst_tensors.push_back({data_type, storage, Layout::HWC});
TensorFloat32 output0;
auto gpu_op0 = CreateConvGeneric(env->GetGpuInfo(), op_def, attr, &dst_shape);
auto op0_ptr = std::make_unique<ConvGeneric>(std::move(gpu_op0));
RETURN_IF_ERROR(
env->ExecuteGPUOperation(src_tensor, std::move(op0_ptr), dst_shape, &output0));
auto gpu_op1 = CreateWinograd4x4To36(op_def, attr.padding, env->GetGpuInfo());
std::unique_ptr<GPUOperation> op1_ptr = std::make_unique<Winograd4x4To36>(std::move(gpu_op1));
auto gpu_op2 = CreateConvGenericWino4x4To6x6(env->GetGpuInfo(), op_def, attr, &conv_shape);
auto op2_ptr = std::make_unique<ConvGeneric>(std::move(gpu_op2));
auto gpu_op3 = CreateWinograd36To4x4(op_def, attr.bias);
std::unique_ptr<GPUOperation> op3_ptr = std::make_unique<Winograd36To4x4>(std::move(gpu_op3));
TensorFloat32 output1;
BHWC output1_shape = conv_shape;
output1_shape.c = src_shape.c;
RETURN_IF_ERROR(
env->ExecuteGPUOperation(src_tensor, std::move(op1_ptr), output1_shape, &output1));
TensorFloat32 output2;
BHWC output2_shape = conv_shape;
RETURN_IF_ERROR(
env->ExecuteGPUOperation(output1, std::move(op2_ptr), output2_shape, &output2));
TensorFloat32 output3;
BHWC output3_shape = dst_shape;
RETURN_IF_ERROR(
env->ExecuteGPUOperation(output2, std::move(op3_ptr), output3_shape, &output3));
RETURN_IF_ERROR(PointWiseNear(output0.data, output3.data, eps))
<< "Failed using precision " << ToString(precision);
}
}
return absl::OkStatus();
}
absl::Status ConvolutionGroupedTest(TestExecutionEnvironment* env) {
TensorFloat32 src_tensor;
src_tensor.shape = BHWC(1, 1, 1, 8);
src_tensor.data = {0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f};
Convolution2DAttributes attr;
attr.groups = 2;
attr.padding.prepended = HW(0, 0);
attr.padding.appended = HW(0, 0);
attr.strides = HW(1, 1);
attr.dilations = HW(1, 1);
attr.weights.shape = OHWI(8, 1, 1, 4);
attr.weights.data = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f,
12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f, 19.0f, 20.0f, 21.0f, 22.0f,
23.0f, 24.0f, 25.0f, 26.0f, 27.0f, 28.0f, 29.0f, 30.0f, 31.0f, 32.0f};
attr.bias.shape = Linear(8);
attr.bias.data = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
for (auto precision : env->GetSupportedPrecisions()) {
auto data_type = DeduceDataTypeFromPrecision(precision);
for (auto storage : env->GetSupportedStorages(data_type)) {
const float eps = precision == CalculationsPrecision::F32 ? 1e-6f : 1e-3f;
OperationDef op_def;
op_def.precision = precision;
op_def.src_tensors.push_back({data_type, storage, Layout::HWC});
op_def.dst_tensors.push_back({data_type, storage, Layout::HWC});
TensorFloat32 dst_tensor;
auto dst_shape = BHWC(1, 1, 1, 8);
ConvGeneric operation = CreateConvGeneric(env->GetGpuInfo(), op_def, attr, &dst_shape);
RETURN_IF_ERROR(env->ExecuteGPUOperation(
src_tensor, std::make_unique<ConvGeneric>(std::move(operation)), dst_shape, &dst_tensor));
RETURN_IF_ERROR(PointWiseNear({20.0f, 44.0f, 68.0f, 92.0f, 412.0f, 500.0f, 588.0f, 676.0f},
dst_tensor.data, eps))
<< "Failed using precision " << ToString(precision);
}
}
return absl::OkStatus();
}
absl::Status ConvolutionSimdMatrixMultiplyTest(TestExecutionEnvironment* env) {
TensorFloat32 src_tensor;
src_tensor.shape = BHWC(1, 32, 32, 1024);
const BHWC dst_shape(1, 32, 32, 1024);
src_tensor.data.resize(src_tensor.shape.DimensionsProduct());
for (int i = 0; i < src_tensor.data.size(); ++i) {
src_tensor.data[i] = sin(0.01f * i);
}
Convolution2DAttributes attr;
attr.padding.prepended = HW(0, 0);
attr.padding.appended = HW(0, 0);
attr.strides = HW(1, 1);
attr.dilations = HW(1, 1);
attr.weights.shape = OHWI(dst_shape.c, 1, 1, src_tensor.shape.c);
attr.weights.data.resize(attr.weights.shape.DimensionsProduct());
for (int i = 0; i < attr.weights.data.size(); ++i) {
attr.weights.data[i] = sin(0.1f * i);
}
attr.bias.shape = Linear(dst_shape.c);
attr.bias.data.resize(attr.bias.shape.DimensionsProduct());
for (int i = 0; i < attr.bias.data.size(); ++i) {
attr.bias.data[i] = sin(0.1f * i);
}
TensorFloat32 dst_tensor_ref;
{
OperationDef op_def;
op_def.precision = CalculationsPrecision::F32;
auto data_type = DeduceDataTypeFromPrecision(op_def.precision);
op_def.src_tensors.push_back({data_type, TensorStorageType::BUFFER, Layout::HWC});
op_def.dst_tensors.push_back({data_type, TensorStorageType::BUFFER, Layout::HWC});
ConvGeneric operation = CreateConvGeneric(env->GetGpuInfo(), op_def, attr, &dst_shape);
RETURN_IF_ERROR(env->ExecuteGPUOperation(src_tensor,
std::make_unique<ConvGeneric>(std::move(operation)),
dst_shape, &dst_tensor_ref));
}
for (auto precision : env->GetSupportedPrecisions()) {
auto data_type = DeduceDataTypeFromPrecision(precision);
for (auto storage : env->GetSupportedStorages(data_type)) {
const float eps = precision == CalculationsPrecision::F32 ? 4e-5f : 0.4f;
OperationDef op_def;
op_def.precision = precision;
op_def.src_tensors.push_back({data_type, storage, Layout::HWC});
op_def.dst_tensors.push_back({data_type, storage, Layout::HWC});
if (!IsConvolutionMetalSimdSupported(env->GetGpuInfo(), op_def, attr)) {
continue;
}
TensorFloat32 dst_tensor_simd;
ConvolutionMetalSimd operation_simd =
CreateConvolutionMetalSimd(op_def, dst_shape, attr, env->GetGpuInfo());
RETURN_IF_ERROR(env->ExecuteGPUOperation(
src_tensor, std::make_unique<ConvolutionMetalSimd>(std::move(operation_simd)), dst_shape,
&dst_tensor_simd));
RETURN_IF_ERROR(PointWiseNear(dst_tensor_ref.data, dst_tensor_simd.data, eps))
<< "Failed using precision " << ToString(precision);
}
}
return absl::OkStatus();
}
absl::Status ConvolutionSimdMatrixMultiplyBatchTest(TestExecutionEnvironment* env) {
TensorFloat32 src_tensor;
src_tensor.shape = BHWC(8, 8, 8, 128);
const BHWC dst_shape(8, 8, 8, 256);
src_tensor.data.resize(src_tensor.shape.DimensionsProduct());
for (int i = 0; i < src_tensor.data.size(); ++i) {
src_tensor.data[i] = sin(0.01f * i);
}
Convolution2DAttributes attr;
attr.padding.prepended = HW(0, 0);
attr.padding.appended = HW(0, 0);
attr.strides = HW(1, 1);
attr.dilations = HW(1, 1);
attr.weights.shape = OHWI(dst_shape.c, 1, 1, src_tensor.shape.c);
attr.weights.data.resize(attr.weights.shape.DimensionsProduct());
for (int i = 0; i < attr.weights.data.size(); ++i) {
attr.weights.data[i] = sin(0.1f * i);
}
attr.bias.shape = Linear(dst_shape.c);
attr.bias.data.resize(attr.bias.shape.DimensionsProduct());
for (int i = 0; i < attr.bias.data.size(); ++i) {
attr.bias.data[i] = sin(0.1f * i);
}
TensorFloat32 dst_tensor_ref;
{
OperationDef op_def;
op_def.precision = CalculationsPrecision::F32;
auto data_type = DeduceDataTypeFromPrecision(op_def.precision);
op_def.src_tensors.push_back({data_type, TensorStorageType::BUFFER, Layout::BHWC});
op_def.dst_tensors.push_back({data_type, TensorStorageType::BUFFER, Layout::BHWC});
ConvGeneric operation = CreateConvGeneric(env->GetGpuInfo(), op_def, attr, &dst_shape);
RETURN_IF_ERROR(env->ExecuteGPUOperation(src_tensor,
std::make_unique<ConvGeneric>(std::move(operation)),
dst_shape, &dst_tensor_ref));
}
for (auto precision : env->GetSupportedPrecisions()) {
auto data_type = DeduceDataTypeFromPrecision(precision);
for (auto storage : env->GetSupportedStorages(data_type)) {
const float eps = precision == CalculationsPrecision::F32 ? 8e-6f : 0.2f;
OperationDef op_def;
op_def.precision = precision;
op_def.src_tensors.push_back({data_type, storage, Layout::BHWC});
op_def.dst_tensors.push_back({data_type, storage, Layout::BHWC});
if (!IsConvolutionMetalSimdSupported(env->GetGpuInfo(), op_def, attr)) {
continue;
}
TensorFloat32 dst_tensor_simd;
ConvolutionMetalSimd operation_simd =
CreateConvolutionMetalSimd(op_def, dst_shape, attr, env->GetGpuInfo());
RETURN_IF_ERROR(env->ExecuteGPUOperation(
src_tensor, std::make_unique<ConvolutionMetalSimd>(std::move(operation_simd)), dst_shape,
&dst_tensor_simd));
RETURN_IF_ERROR(PointWiseNear(dst_tensor_ref.data, dst_tensor_simd.data, eps))
<< "Failed using precision " << ToString(precision);
}
}
return absl::OkStatus();
}
absl::Status ConvolutionSimdMatrixMultiplyPerfTest() {
const BHWC src_shape(1, 32, 32, 1024);
const BHWC dst_shape(1, 32, 32, 1024);
Convolution2DAttributes attr;
attr.padding.prepended = HW(0, 0);
attr.padding.appended = HW(0, 0);
attr.strides = HW(1, 1);
attr.dilations = HW(1, 1);
attr.weights.shape = OHWI(dst_shape.c, 1, 1, src_shape.c);
attr.weights.data.resize(attr.weights.shape.DimensionsProduct());
for (int i = 0; i < attr.weights.data.size(); ++i) {
attr.weights.data[i] = sin(0.1f * i);
}
attr.bias.shape = Linear(dst_shape.c);
attr.bias.data.resize(attr.bias.shape.DimensionsProduct());
for (int i = 0; i < attr.bias.data.size(); ++i) {
attr.bias.data[i] = sin(0.1f * i);
}
MetalDevice device;
OperationDef op_def;
op_def.precision = CalculationsPrecision::F32;
auto data_type = DeduceDataTypeFromPrecision(op_def.precision);
op_def.src_tensors.push_back({data_type, TensorStorageType::BUFFER, Layout::HWC});
op_def.dst_tensors.push_back({data_type, TensorStorageType::BUFFER, Layout::HWC});
ConvolutionMetalSimd operation_simd =
CreateConvolutionMetalSimd(op_def, dst_shape, attr, device.GetInfo());
auto op_ptr = std::make_unique<ConvolutionMetalSimd>(std::move(operation_simd));
MetalSpatialTensor src_gpu, dst_gpu;
TensorDescriptor descriptor_with_shape = op_def.src_tensors[0];
descriptor_with_shape.SetBHWCShape(src_shape);
RETURN_IF_ERROR(CreateTensor(device.device(), descriptor_with_shape, &src_gpu));
descriptor_with_shape = op_def.dst_tensors[0];
descriptor_with_shape.SetBHWCShape(dst_shape);
RETURN_IF_ERROR(CreateTensor(device.device(), descriptor_with_shape, &dst_gpu));
RETURN_IF_ERROR(op_ptr->AssembleCode(device.GetInfo()));
ComputeTask gpu_task;
gpu_task.Init(std::move(op_ptr));
RETURN_IF_ERROR(gpu_task.Compile(&device));
gpu_task.SetSrcTensor(&src_gpu, 0);
gpu_task.SetDstTensor(&dst_gpu, 0);
RETURN_IF_ERROR(gpu_task.UpdateParams());
const double ops_count = 2.0 * dst_shape.w * dst_shape.h * dst_shape.c * attr.weights.shape.i;
const double gops_count = ops_count * 1e-9;
id<MTLCommandQueue> command_queue = [device.device() newCommandQueue];
const int iterations = 10;
const int iteration_size = 100;
double alu_fp32_gflops_per_cu = 162.0;
if (device.GetInfo().apple_info.gpu_type == AppleGpu::kA15) {
alu_fp32_gflops_per_cu *= 2.0;
}
double alu_fp16_gflops_per_cu = 162.0 * 2.0;
double alu_gflops_per_gpu;
if (op_def.precision == CalculationsPrecision::F32) {
alu_gflops_per_gpu =
alu_fp32_gflops_per_cu * device.GetInfo().apple_info.GetComputeUnitsCount();
} else {
alu_gflops_per_gpu =
alu_fp16_gflops_per_cu * device.GetInfo().apple_info.GetComputeUnitsCount();
}
for (int i = 0; i < iterations; ++i) {
@autoreleasepool {
id<MTLCommandBuffer> command_buffer = [command_queue commandBuffer];
for (int j = 0; j < iteration_size; ++j) {
id<MTLComputeCommandEncoder> encoder = [command_buffer computeCommandEncoder];
gpu_task.Encode(encoder);
[encoder endEncoding];
}
const auto start = std::chrono::high_resolution_clock::now();
[command_buffer commit];
[command_buffer waitUntilCompleted];
const auto end = std::chrono::high_resolution_clock::now();
const std::chrono::duration<double> diff = end - start;
const double execution_time_ms = diff.count() / static_cast<double>(iteration_size) * 1000.0;
const double fps = 1000.0 / execution_time_ms;
const double pers = gops_count * fps / alu_gflops_per_gpu * 100.0;
std::cout << execution_time_ms << " ms, " << gops_count * fps << " GFLOPS(" << pers << "%)"
<< std::endl;
}
}
return absl::OkStatus();
}
} // namespace metal
} // namespace gpu
} // namespace tflite
- (void)testWinograd4x4To6x6 {
auto status = tflite::gpu::metal::Winograd4x4To6x6Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testGroupedConvolution {
auto status = tflite::gpu::metal::ConvolutionGroupedTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConvGeneric1x1SimpleWeights {
const auto status = ConvGeneric1x1SimpleWeightsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConvGeneric1x1 {
const auto status = ConvGeneric1x1Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConvGenericSimpleWeights {
const auto status = ConvGenericSimpleWeightsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConvGeneric {
const auto status = ConvGenericTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConvGenericGrouped {
const auto status = ConvGenericGroupedTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConvConstantsSimpleWeights {
const auto status = ConvConstantsSimpleWeightsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConvConstants {
const auto status = ConvConstantsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConvSimdMatrixMultiply {
const auto status = tflite::gpu::metal::ConvolutionSimdMatrixMultiplyTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConvSimdMatrixMultiplyBatch {
const auto status = tflite::gpu::metal::ConvolutionSimdMatrixMultiplyBatchTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConvSimdMatrixMultiplyPerf {
const auto status = tflite::gpu::metal::ConvolutionSimdMatrixMultiplyPerfTest();
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,59 @@
/* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/conv_weights_converter_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface ConvWeightsConverterMetalTest : XCTestCase
@end
@implementation ConvWeightsConverterMetalTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testConverterToConvWeights1x1OutX4 {
const auto status = ConverterToConvWeights1x1OutX4Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConverterToConvWeights1x1OutX4Unaligned {
const auto status = ConverterToConvWeights1x1OutX4UnalignedTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConverterToConvWeights1x1OutX2 {
const auto status = ConverterToConvWeights1x1OutX2Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConverterToConvWeightsOutX2 {
const auto status = ConverterToConvWeightsOutX2Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConverterToConvTransposedWeights4x4 {
const auto status = ConverterToConvTransposedWeights4x4Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConverterToConvWeights4xTextures {
const auto status = ConverterToConvWeights4xTexturesTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,38 @@
/* Copyright 2022 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/cumsum_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface CumsumMetalTest : XCTestCase
@end
@implementation CumsumMetalTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testCumsum {
auto status = CumsumHWCTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testCumsumBatch {
auto status = CumsumBHWCTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,61 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/depthwise_conv_3x3_stride_h2_test_util.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/depthwise_conv_3x3_test_util.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/depthwise_conv_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface DepthwiseConvMetalTest : XCTestCase
@end
@implementation DepthwiseConvMetalTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testDepthwiseConvSimpleWeights {
auto status = DepthwiseConvSimpleWeightsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testDepthwiseConvNoMultiplier {
auto status = DepthwiseConvNoMultiplierTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testDepthwiseConvMultiplier2 {
auto status = DepthwiseConvMultiplier2Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testDepthwiseConv3x3SimpleWeights {
auto status = DepthwiseConv3x3SimpleWeightsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testDepthwiseConv3x3 {
auto status = DepthwiseConv3x3Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testDepthWiseConv3x3StrideH2SimpleWeights {
auto status = DepthWiseConv3x3StrideH2SimpleWeightsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,254 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/elementwise_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface ElementwiseTest : XCTestCase
@end
@implementation ElementwiseTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testAbsUnit {
auto status = AbsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testCosUnit {
auto status = CosTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testCopyUnit {
auto status = CopyTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testEluUnit {
auto status = EluTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testExpUnit {
auto status = ExpTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testFloorUnit {
auto status = FloorTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testFloorDivUnit {
auto status = FloorDivTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testFloorModUnit {
auto status = FloorModTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testHardSwishUnit {
auto status = HardSwishTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testLogUnit {
auto status = LogTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testNegUnit {
auto status = NegTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testRsqrtUnit {
auto status = RsqrtTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSigmoidUnit {
auto status = SigmoidTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSinUnit {
auto status = SinTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSqrtUnit {
auto status = SqrtTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSquareUnit {
auto status = SquareTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testTanhUnit {
auto status = TanhTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSubUnit {
auto status = SubTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSquaredDiffUnit {
auto status = SquaredDiffTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testDivUnit {
auto status = DivTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testPowUnit {
auto status = PowTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testAddUnit {
auto status = AddTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testMaximumUnit {
auto status = MaximumTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testMaximumWithScalarUnit {
auto status = MaximumWithScalarTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testMaximumWithConstantLinearTensorUnit {
auto status = MaximumWithConstantLinearTensorTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testMaximumWithConstantHWCTensorUnit {
auto status = MaximumWithConstantHWCTensorTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testMaximumWithConstantHWCTensorBroadcastChannelsUnit {
auto status = MaximumWithConstantHWCTensorBroadcastChannelsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testMinimumUnit {
auto status = MinimumTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testMinimumWithScalarUnit {
auto status = MinimumWithScalarTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testMulUnit {
auto status = MulTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testMulBroadcastHWUnit {
auto status = MulBroadcastHWTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testMulBroadcastChannelsUnit {
auto status = MulBroadcastChannelsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSubWithScalarAtFirstPositionUnit {
auto status = SubWithScalarAtFirstPositionTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testLessUnit {
auto status = LessTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testLessEqualUnit {
auto status = LessEqualTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testGreaterUnit {
auto status = GreaterTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testGreaterEqualUnit {
auto status = GreaterEqualTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testEqualUnit {
auto status = EqualTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testNotEqualUnit {
auto status = NotEqualTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testCosBroadcast {
auto status = CosBroadcastTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testMaximumScalarBroadcastInput {
auto status = MaximumScalarBroadcastInputTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testMulLinearBroadcastInput {
auto status = MulLinearBroadcastInputTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testMulBroadcastBothInputs {
auto status = MulBroadcastBothInputsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testLogicalAnd {
auto status = LogicalAndTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testLogicalAndWithConstant {
auto status = LogicalAndWithConstantTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,49 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/fully_connected_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface FullyConnectedMetalTest : XCTestCase
@end
@implementation FullyConnectedMetalTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testFullyConnected {
auto status = tflite::gpu::FullyConnectedTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testFullyConnectedLarge {
auto status = FullyConnectedLargeTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testFullyConnectedExtraLarge {
auto status = FullyConnectedExtraLargeTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testFullyConnectedInt8 {
auto status = FullyConnectedInt8Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,34 @@
/* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/gather_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface GatherMetalTest : XCTestCase
@end
@implementation GatherMetalTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testGatherWidth {
auto status = GatherWidthTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,38 @@
/* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/lstm_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface LSTMMetalTest : XCTestCase
@end
@implementation LSTMMetalTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)setUp {
[super setUp];
}
- (void)testLSTM {
auto status = LstmTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,34 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/max_unpooling_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface MaxUnpoolingMetalTest : XCTestCase
@end
@implementation MaxUnpoolingMetalTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testMaxUnpooling {
auto status = MaxUnpoolingTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,78 @@
/* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/mean_stddev_normalization_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface MeanStddevNormalizationTest : XCTestCase
@end
@implementation MeanStddevNormalizationTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
// note: 100.01 is not representable in FP16 (is in FP32), so use 101.0 instead.
- (void)testMeanStddevNormSeparateBatches {
// zero mean, zero variance
auto status = MeanStddevNormSeparateBatchesTest(0.0f, 0.0f, 0.0f, &exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
// zero mean, small variance
status = MeanStddevNormSeparateBatchesTest(0.0f, 0.01f, 2.63e-4f, &exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
// zero mean, large variance
status = MeanStddevNormSeparateBatchesTest(0.0f, 100.0f, 2.63e-4f, &exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
// small mean, zero variance
status = MeanStddevNormSeparateBatchesTest(0.01f, 0.0f, 0.0f, &exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
// small mean, small variance
status = MeanStddevNormSeparateBatchesTest(0.01f, 0.01f, 3.57e-4f, &exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
// small mean, large variance
status = MeanStddevNormSeparateBatchesTest(1.0f, 100.0f, 2.63e-4f, &exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
// large mean, zero variance
status = MeanStddevNormSeparateBatchesTest(100.0f, 0.0f, 0.0f, &exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
// large mean, small variance
status = MeanStddevNormSeparateBatchesTest(100.0f, 1.0f, 2.63e-4f, &exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
// large mean, large variance
status = MeanStddevNormSeparateBatchesTest(100.0f, 100.0f, 2.63e-4f, &exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testMeanStddevNormalizationAllBatches {
auto status = MeanStddevNormalizationAllBatchesTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testMeanStddevNormalizationLargeVector {
auto status = MeanStddevNormalizationLargeVectorTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,39 @@
/* Copyright 2022 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/one_hot_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface OneHotMetalTest : XCTestCase
@end
@implementation OneHotMetalTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testOneHot {
auto status = OneHotTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testOneHotBatch {
auto status = OneHotBatchTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,79 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/padding_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface PaddingTest : XCTestCase
@end
@implementation PaddingTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testPaddingAppendWidth {
auto status = PaddingAppendWidthTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testPaddingPrependWidth {
auto status = PaddingPrependWidthTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testPaddingAppendHeight {
auto status = PaddingAppendHeightTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testPaddingPrependHeight {
auto status = PaddingPrependHeightTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testPaddingAppendChannels {
auto status = PaddingAppendChannelsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testPaddingPrependChannels {
auto status = PaddingPrependChannelsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testPaddingPrependChannelsX4 {
auto status = PaddingPrependChannelsX4Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testPaddingComplex {
auto status = PaddingComplexTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testPaddingReflectWidth {
auto status = PaddingReflectWidthTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testPaddingReflectChannels {
auto status = PaddingReflectChannelsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,49 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/pooling_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface PoolingTest : XCTestCase
@end
@implementation PoolingTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testAveragePooling {
auto status = AveragePoolingTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testAveragePoolingNonEmptyPadding {
auto status = AveragePoolingNonEmptyPaddingTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testMaxPooling {
auto status = MaxPoolingTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testMaxPoolingIndices {
auto status = MaxPoolingIndicesTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,43 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/prelu_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface PReLUTest : XCTestCase
@end
@implementation PReLUTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)setUp {
[super setUp];
}
- (void)testPReLUAlpha {
auto status = PReLUAlphaTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testPReLUHWCAlpha {
auto status = PReLUHWCAlphaTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,49 @@
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/quantize_and_dequantize_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface QuantizeAndDequantizeTest : XCTestCase
@end
@implementation QuantizeAndDequantizeTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testQuantAndDequant_Dim2Bits8 {
auto status = QuantAndDequant_Dim2Bits8Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testQuantAndDequant_Dim3Bits8_NegativeRange {
auto status = QuantAndDequant_Dim3Bits8_NegativeRangeTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testQuantAndDequant_Dim3Bits16 {
auto status = QuantAndDequant_Dim3Bits16Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testQuantAndDequant_Dim2Bits16_NegativeRange {
auto status = QuantAndDequant_Dim2Bits16_NegativeRangeTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,54 @@
/* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/reduce_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface ReduceTest : XCTestCase
@end
@implementation ReduceTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testMeanHW {
auto status = MeanHWTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testReduceSumChannels {
auto status = ReduceSumChannelsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testReduceProductChannels {
auto status = ReduceProductChannelsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testReduceMaxChannels {
auto status = ReduceMaxChannelsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testReduceMinChannels {
auto status = ReduceMinChannelsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,49 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/relu_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface ReLUTest : XCTestCase
@end
@implementation ReLUTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testReLUNoClipNoAlpha {
auto status = ReLUNoClipNoAlphaTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testReLUClip {
auto status = ReLUClipTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testReLUAlpha {
auto status = ReLUAlphaTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testReLUAlphaClip {
auto status = ReLUAlphaClipTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,43 @@
/* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include <vector>
#include "tensorflow/lite/delegates/gpu/common/shape.h"
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/resampler_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface ResamplerTest : XCTestCase
@end
@implementation ResamplerTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testResamplerIdentity {
auto status = ResamplerIdentityTest(tflite::gpu::BHWC(1, 2, 2, 1), &exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
status = ResamplerIdentityTest(tflite::gpu::BHWC(1, 3, 5, 3), &exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
status = ResamplerIdentityTest(tflite::gpu::BHWC(1, 6, 1, 7), &exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,39 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/reshape_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface ReshapeMetalTest : XCTestCase
@end
@implementation ReshapeMetalTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testReshape {
auto status = ReshapeTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testReshapex4 {
auto status = Reshapex4Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,64 @@
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/resize_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface ResizeTest : XCTestCase
@end
@implementation ResizeTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testResizeBilinearAligned {
auto status = ResizeBilinearAlignedTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testResizeBilinearNonAligned {
auto status = ResizeBilinearNonAlignedTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testResizeBilinearWithoutHalfPixel {
auto status = ResizeBilinearWithoutHalfPixelTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testResizeBilinearWithHalfPixel {
auto status = ResizeBilinearWithHalfPixelTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testResizeNearest {
auto status = ResizeNearestTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testResizeNearestAlignCorners {
auto status = ResizeNearestAlignCornersTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testResizeNearestHalfPixelCenters {
auto status = ResizeNearestHalfPixelCentersTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,69 @@
/* Copyright 2022 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/tasks/select_v2_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface SelectV2MetalTest : XCTestCase
@end
@implementation SelectV2MetalTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testSelectV2Test {
auto status = SelectV2Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSelectV2BatchTest {
auto status = SelectV2BatchTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSelectV2ChannelsTest {
auto status = SelectV2ChannelsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSelectV2ChannelsBatchTest {
auto status = SelectV2ChannelsBatchTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSelectV2BroadcastTrueTest {
auto status = SelectV2BroadcastTrueTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSelectV2BroadcastElseTest {
auto status = SelectV2BroadcastFalseTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSelectV2BroadcastBothTest {
auto status = SelectV2BroadcastBothTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSelectV2ChannelsBroadcastElseTest {
auto status = SelectV2ChannelsBroadcastFalseTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,34 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/strided_slice_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface SliceTest : XCTestCase
@end
@implementation SliceTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testStridedSlice {
auto status = StridedSliceTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,49 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/softmax_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface SoftmaxMetalTest : XCTestCase
@end
@implementation SoftmaxMetalTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testSoftmax {
auto status = SoftmaxTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSoftmaxBigNumber {
auto status = SoftmaxBigNumberTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSoftmax1x1 {
auto status = Softmax1x1Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSoftmax1x1BigNumber {
auto status = Softmax1x1BigNumberTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,54 @@
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/space_to_depth_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface SpaceToDepthTest : XCTestCase
@end
@implementation SpaceToDepthTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testSpaceToDepthTensorShape1x2x2x1BlockSize2 {
auto status = SpaceToDepthTensorShape1x2x2x1BlockSize2Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSpaceToDepthTensorShape1x2x2x2BlockSize2 {
auto status = SpaceToDepthTensorShape1x2x2x2BlockSize2Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSpaceToDepthTensorShape1x2x2x3BlockSize2 {
auto status = SpaceToDepthTensorShape1x2x2x3BlockSize2Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSpaceToDepthTensorShape1x4x4x1BlockSize2 {
auto status = SpaceToDepthTensorShape1x4x4x1BlockSize2Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSpaceToDepthTensorShape1x6x6x1BlockSize3 {
auto status = SpaceToDepthTensorShape1x6x6x1BlockSize3Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,59 @@
/* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/split_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface SplitTest : XCTestCase
@end
@implementation SplitTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testSplitChannels {
auto status = SplitChannelsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSplitChannelsX4 {
auto status = SplitChannelsX4Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSplitWidth {
auto status = SplitWidthTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSplitHeight {
auto status = SplitHeightTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSplitBatch {
auto status = SplitBatchTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testSplitDepth {
auto status = SplitDepthTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,139 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
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 "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
#import <Metal/Metal.h>
#include <functional>
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "absl/strings/substitute.h"
#include "tensorflow/lite/delegates/gpu/common/convert.h"
#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/common/precision.h"
#include "tensorflow/lite/delegates/gpu/common/shape.h"
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tensor.h"
#include "tensorflow/lite/delegates/gpu/common/types.h"
#include "tensorflow/lite/delegates/gpu/common/util.h"
#include "tensorflow/lite/delegates/gpu/metal/compute_task.h"
#include "tensorflow/lite/delegates/gpu/metal/metal_spatial_tensor.h"
namespace tflite {
namespace gpu {
namespace metal {
std::vector<CalculationsPrecision>
MetalExecutionEnvironment::GetSupportedPrecisions() const {
return {CalculationsPrecision::F32, CalculationsPrecision::F32_F16,
CalculationsPrecision::F16};
}
std::vector<TensorStorageType> MetalExecutionEnvironment::GetSupportedStorages(
DataType data_type) const {
return {TensorStorageType::BUFFER, TensorStorageType::IMAGE_BUFFER,
TensorStorageType::TEXTURE_2D, TensorStorageType::TEXTURE_3D,
TensorStorageType::TEXTURE_ARRAY};
}
absl::Status MetalExecutionEnvironment::ExecuteGpuOperationInternal(
const std::vector<TensorDescriptor*>& src_cpu,
const std::vector<TensorDescriptor*>& dst_cpu,
std::unique_ptr<GPUOperation>&& operation) {
const OperationDef& op_def = operation->GetDefinition();
std::vector<MetalSpatialTensor> src(src_cpu.size());
for (int i = 0; i < src_cpu.size(); ++i) {
RETURN_IF_ERROR(src[i].CreateFromDescriptor(*src_cpu[i], device_.device()));
operation->SetSrc(&src[i], i);
}
std::vector<MetalSpatialTensor> dst(dst_cpu.size());
for (int i = 0; i < dst_cpu.size(); ++i) {
TensorDescriptor descriptor_with_shape = op_def.dst_tensors[i];
descriptor_with_shape.SetBHWDCShape(dst_cpu[i]->GetBHWDCShape());
RETURN_IF_ERROR(
CreateTensor(device_.device(), descriptor_with_shape, &dst[i]));
operation->SetDst(&dst[i], i);
}
ComputeTask gpu_task;
gpu_task.Init(std::move(operation));
RETURN_IF_ERROR(gpu_task.Compile(&device_));
for (int i = 0; i < src_cpu.size(); ++i) {
gpu_task.SetSrcTensor(&src[i], i);
}
for (int i = 0; i < dst_cpu.size(); ++i) {
gpu_task.SetDstTensor(&dst[i], i);
}
RETURN_IF_ERROR(gpu_task.UpdateParams());
bool use_icb = false;
if (use_icb) {
if (@available(macOS 11.00, iOS 13.0, tvOS 13.0, *)) {
MTLIndirectCommandBufferDescriptor* icb_desc =
[[MTLIndirectCommandBufferDescriptor alloc] init];
icb_desc.commandTypes = MTLIndirectCommandTypeConcurrentDispatch;
icb_desc.inheritBuffers = NO;
icb_desc.inheritPipelineState = NO;
icb_desc.maxKernelBufferBindCount = 1;
id<MTLIndirectCommandBuffer> icb =
[device_.device() newIndirectCommandBufferWithDescriptor:icb_desc
maxCommandCount:1
options:0];
id<MTLIndirectComputeCommand> icb_command =
[icb indirectComputeCommandAtIndex:0];
gpu_task.EncodeToICB(icb_command);
[icb_command setBarrier];
id<MTLCommandQueue> command_queue = [device_.device() newCommandQueue];
id<MTLCommandBuffer> command_buffer = [command_queue commandBuffer];
id<MTLComputeCommandEncoder> encoder =
[command_buffer computeCommandEncoder];
gpu_task.AddResourcesToEncoder(encoder);
[encoder executeCommandsInBuffer:icb withRange:NSMakeRange(0, 1)];
[encoder endEncoding];
[command_buffer commit];
[command_buffer waitUntilCompleted];
} else {
return absl::InternalError(
"Indirect compute command buffer available since ios 13");
}
} else {
id<MTLCommandQueue> command_queue = [device_.device() newCommandQueue];
id<MTLCommandBuffer> command_buffer = [command_queue commandBuffer];
id<MTLComputeCommandEncoder> encoder =
[command_buffer computeCommandEncoder];
gpu_task.Encode(encoder);
[encoder endEncoding];
[command_buffer commit];
[command_buffer waitUntilCompleted];
}
for (int i = 0; i < dst_cpu.size(); ++i) {
RETURN_IF_ERROR(dst[i].ToDescriptor(dst_cpu[i], device_.device()));
}
return absl::OkStatus();
}
} // namespace metal
} // namespace gpu
} // namespace tflite
@@ -0,0 +1,60 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
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 TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_TEST_UTIL_H_
#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_TEST_UTIL_H_
#import <Metal/Metal.h>
#include <map>
#include <memory>
#include <vector>
#include "tensorflow/lite/delegates/gpu/common/shape.h"
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/task/gpu_operation.h"
#include "tensorflow/lite/delegates/gpu/common/task/testing_util.h"
#include "tensorflow/lite/delegates/gpu/common/tensor.h"
#include "tensorflow/lite/delegates/gpu/metal/metal_device.h"
namespace tflite {
namespace gpu {
namespace metal {
class MetalExecutionEnvironment : public TestExecutionEnvironment {
public:
MetalExecutionEnvironment() = default;
~MetalExecutionEnvironment() = default;
std::vector<CalculationsPrecision> GetSupportedPrecisions() const override;
std::vector<TensorStorageType> GetSupportedStorages(
DataType data_type) const override;
const GpuInfo& GetGpuInfo() const override { return device_.GetInfo(); }
absl::Status ExecuteGpuOperationInternal(
const std::vector<TensorDescriptor*>& src_cpu,
const std::vector<TensorDescriptor*>& dst_cpu,
std::unique_ptr<GPUOperation>&& operation) override;
private:
MetalDevice device_;
};
} // namespace metal
} // namespace gpu
} // namespace tflite
#endif // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_TEST_UTIL_H_
@@ -0,0 +1,54 @@
/* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/tile_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface TileTest : XCTestCase
@end
@implementation TileTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testTileChannels {
auto status = TileChannelsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testTileChannelsX4 {
auto status = TileChannelsX4Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testTileWidth {
auto status = TileWidthTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testTileHeight {
auto status = TileHeightTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testTileHWC {
auto status = TileHWCTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,76 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include <vector>
#include "tensorflow/lite/delegates/gpu/common/operations.h"
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/convolution_transposed_3x3_test_util.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/convolution_transposed_3x3_thin_test_util.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/convolution_transposed_4x4_test_util.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/convolution_transposed_test_util.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/convolution_transposed_thin_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface TransposeConvTest : XCTestCase
@end
@implementation TransposeConvTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testConvolutionTransposedSimpleWeights {
auto status = ConvolutionTransposedSimpleWeightsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConvolutionTransposed {
auto status = ConvolutionTransposedTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConvolutionTransposed4x4SimpleWeights {
auto status = ConvolutionTransposed4x4SimpleWeightsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConvolutionTransposedThinSimpleWeights {
auto status = ConvolutionTransposedThinSimpleWeightsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConvolutionTransposedThin {
auto status = ConvolutionTransposedThinTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConvolutionTransposed3x3ThinSimpleWeights {
auto status = ConvolutionTransposed3x3ThinSimpleWeightsTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConvolutionTransposed3x3Thin {
auto status = ConvolutionTransposed3x3ThinTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testConvolutionTransposed3x3 {
auto status = ConvolutionTransposed3x3Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,41 @@
/* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include <vector>
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
#include "tensorflow/lite/delegates/gpu/common/operations.h"
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/transpose_test_util.h"
@interface TransposeMetalTest : XCTestCase
@end
@implementation TransposeMetalTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)setUp {
[super setUp];
}
- (void)testTranspose {
auto status = TransposeTest(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end
@@ -0,0 +1,52 @@
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#import <XCTest/XCTest.h>
#include <vector>
#include "tensorflow/lite/delegates/gpu/common/operations.h"
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/tasks/winograd_test_util.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/test_util.h"
@interface WinogradTest : XCTestCase
@end
@implementation WinogradTest {
tflite::gpu::metal::MetalExecutionEnvironment exec_env_;
}
- (void)testWinograd4x4To36TileX6 {
auto status = tflite::gpu::Winograd4x4To36TileX6Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testWinograd36To4x4Tile4x1 {
auto status = tflite::gpu::Winograd36To4x4Tile4x1Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testWinograd4x4To36 {
auto status = tflite::gpu::Winograd4x4To36Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
- (void)testWinograd36To4x4 {
auto status = tflite::gpu::Winograd36To4x4Test(&exec_env_);
XCTAssertTrue(status.ok(), @"%s", std::string(status.message()).c_str());
}
@end